Hiall!
I have a demo viewer page for javascript stuff that has three buttons "DEMO"
"HTML" and "JSCR", and an IFRAME called 'viewer'.
Initially, the IFRAME gets loaded with the actual demo page, ie.,
viewer.location = dName + '.html';
where dName is the filename of the demo without extension.
Clicking on "HTML" replaces the IFRAME contents like this:
viewer.location = "view-source:" + viewer.location .href;
And Clicking on "JSCR" replaces the IFRAME contents like this:
viewer.location = dName + '.js';
These all work OK by themselves - at least at first. The problem comes when I
Click "JSCR" to display the appropriate .js file, and then click "HTML" to go
back to the source of the HTML file: I just get the .js file again (and it's
fairly obvious why).
I tried doing this in the "HTML" click:
viewer.location = dName + '.html';
viewer.location = "view-source:" + viewer.location .href;
attempting to reload the demo page before showing its source, but this doesn't
work very well - I have to click "HTML" 2 or 3 times to get the source to
appear (because, I think, both these lines need the function to return before
anything really happens visually).
In a nutshell:
How I can view (in an IFRAME) the source of an html page which is not the
IFRAME's current document.locati on?
TIA
Pete
I have a demo viewer page for javascript stuff that has three buttons "DEMO"
"HTML" and "JSCR", and an IFRAME called 'viewer'.
Initially, the IFRAME gets loaded with the actual demo page, ie.,
viewer.location = dName + '.html';
where dName is the filename of the demo without extension.
Clicking on "HTML" replaces the IFRAME contents like this:
viewer.location = "view-source:" + viewer.location .href;
And Clicking on "JSCR" replaces the IFRAME contents like this:
viewer.location = dName + '.js';
These all work OK by themselves - at least at first. The problem comes when I
Click "JSCR" to display the appropriate .js file, and then click "HTML" to go
back to the source of the HTML file: I just get the .js file again (and it's
fairly obvious why).
I tried doing this in the "HTML" click:
viewer.location = dName + '.html';
viewer.location = "view-source:" + viewer.location .href;
attempting to reload the demo page before showing its source, but this doesn't
work very well - I have to click "HTML" 2 or 3 times to get the source to
appear (because, I think, both these lines need the function to return before
anything really happens visually).
In a nutshell:
How I can view (in an IFRAME) the source of an html page which is not the
IFRAME's current document.locati on?
TIA
Pete
Comment