« Prev 1 2 3 4 5 6 7 8 9 10 Next »

How to refresh the page only one time after 5 sec in JavaScript?

Create Date: July 08, 2019 at 10:19 AM         Tag: JAVASCRIPT         Author Name: Sun, Charles

How to refresh the page only one time after 5 sec in JavaScript?

I think better solution is check document.referer and compare with document.location

if (document.referrer !== document.location.href) {
    setTimeout(function() {
        document.location.reload()
  }, 5000);
}

You can try this in jsfiddle: https://jsfiddle.net/ga0Lrurj/

New Comment

How to get the query string by javascript?

Create Date: June 20, 2019 at 12:19 PM         Tag: JAVASCRIPT         Author Name: Sun, Charles

How to get the query string by javascript?

You can easily build a dictionary style collection...

function getQueryStrings() { 
  var assoc  = {};
  var decode = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); };
  var queryString = location.search.substring(1); 
  var keyValues = queryString.split('&'); 

  for(var i in keyValues) { 
    var key = keyValues[i].split('=');
    if (key.length > 1) {
      assoc[decode(key[0])] = decode(key[1]);
    }
  } 

  return assoc; 
} 

And use it like this...

var qs = getQueryStrings();
var myParam = qs["myParam"]; 
New Comment

Angular for .net developer

Create Date: May 31, 2019 at 01:56 PM         Tag: ANGULAR         Author Name: Sun, Charles

Matt Baughn @ Denver Dev Day

create-nx-workspace workspace -- create--applicaton

architecture:

jest.config.js for unit test

New Comment
« Prev 1 2 3 4 5 6 7 8 9 10 Next »