Disable JavaScript on window.open

Posted by sonofdelphi on Stack Overflow See other posts from Stack Overflow or by sonofdelphi
Published on 2010-04-30T05:13:08Z Indexed on 2010/04/30 5:17 UTC
Read the original article Hit count: 327

Filed under:
|

I have a set of (X)HTML files that I need to open with window.open() from an application homepage. I am able to open these files and read the data within them.

function openFiles()
{
    var files = document.querySelectorAll('td a'); //The list of files to scan is stored as links in an HTML table

    for(var i = 0; i<files.length; i++){
        //Open each file in a browser window
        win = window.open(files[i].href);
        //Can I prevent the JavaScript in these files from executing?
    }
}

But the problem is that the scripts within the HTML files also get executed when opened like this. This is rather time-consuming and unnecessary; also, the scripts within those files may have side-effects.

Is there a way to prevent JavaScript from executing on load?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about window.open