Reputation: 12245
I want to save an HTML file to disk, and make it possible to be opened in most browsers without warnings (no web-server scenario).
For IE normally I used to go with "mark of the web", which was safely ignored by most browsers (in particular, by Firefox and Chrome). IE after finding this mark of the web also behaved properly and did not display any warnings. You can check more on what mark of the web is in MSDN.
Now the problem. Microsoft Edge after seeing this "mark of the web" shocks and stops executing included javascripts files. What the hell ?! If I remove the "mark of the web" and open file in Edge, it opens normally (without warnings, and javascripts are executed).
Can I make both IE and Edge work for the same file?
index.html
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<script src="foo.js" ></script>
</head>
<body>
</body>
</html>
foo.js
alert('i am executed');
The above does not execute in Edge at all (if opened from file system)! How to make it happen?
Upvotes: 2
Views: 1243
Reputation: 36
You need a mark-of-the-web on foo.js
as well. There are several ways to apply a mark-of-the-web to a non-HTML file -- you can set its integrity level to "low":
icacls foo.js /setintegritylevel low
Or you can add an alternate data stream with a zone identifier:
powershell -c add-content foo.js -stream Zone.Identifier -value "[ZoneTransfer]","ZoneId=3"
Or maybe the easiest way is to rename index.html
to index.htm
and then put foo.js
in a directory called index_files
. Anything in that directory is always allowed to be loaded, even if it doesn't have its own mark-of-the-web.
Upvotes: 2