I am trying to find a way in client side JavaScript (my ISP does not support SSI’s) to store the HTML source code of a given web page in a JavaScript variable.
I want to do this to filter out a pop up ad from a served piece of HTML before displaying it in an iframe.
The closest I got was :
<head>
function ViewSource() {
window.location = “view-source:” + “
}
</head>
<body>
<a href=”javascript:ViewSource()”>View Source</a>
</body>
This simply duplicates the view source menu item. I was hoping there may be a replacement for the “view-source:” part of it, something along the lines of “extract-source:” and have a variable name instead of window.location
I know the address of the HTML code I want to manipulate and it is currently loaded directly into the iframe from that address. Problem is, the HTML code that is loaded into the iframe from that address contains a pop-up ad.
I want to store the contents of the HTML source into a JavaScript variable, I want to then remove the pop-up ad code from that variable, and then load the updated contents of that variable (original HTML code minus the pop-up ad code) into the iframe.
I do not want to display the HTML source in the iframe, I want to manipulate the HTML source and load it into the iframe as HTML code instead.
Any ideas?
Thanks,
Nick S.