I am doing some examples for javascript; they cannot be used. This is interesting - it works on Chrome (and others using webkit) and Safari. So can anyone suggest any reason why it doesn't work in other browsers that I tested?
One possible explanation is that other browsers don’t read the meta tags after loading the page or they don’t read the new ones added.
if (document.createElement) {
var meta = document.createElement('meta');
var metaContent = '2; URL=http://localhost/new.html';
meta.setAttribute('http-equiv', 'refresh');
meta.setAttribute( 'content', metaContent );
document.getElementsByTagName('head')[0].appendChild(meta);
}
source
share