I can’t even believelocation.replace('javascript:page' + page + '()')
works, but I simply moved the css into the returned html and images were hidden.
function page1() {
return "<html><head><style>.heraldone #text2,.heraldone #text3,.heraldone #text4,.heraldone #text5 {display: none;}</style></head><body class="heraldone"><script src="http://feed.informer.com/widgets/J9HBCBNMTQ.js"><\/script><\/body><\/html>";
}
function page2() {
return '<html><body>Hello world (2)</body></html>';
}
function nextpage(page) {
if (!document.image) {
location.replace('javascript:page' + page + '()');
} else {
location.href="javascript:page" + page + '()';
}
}
Not sure what you are up to, but I would have chosen to replace out the body content of the main html page, rather than whatever dark magic is allowing this to even work as intended. This would have the benefit of keeping the returned page html to be smaller, and easier to follow. Something like var pages = ['<script ... />','Hello world']; document.getElementsByTagName('body')[0].innerHTML = pages[page-1];
7
solved CSS not working for html elements created in javascript [closed]