Skip to content

Instantly share code, notes, and snippets.

@purtuga purtuga/ie.aspx
Last active Jan 11, 2019

What would you like to do?
SharePoint file that forces IE into EDGE mode and load a given aspx page in an iframe. See
<!DOCTYPE html>
Set the IE rendering engine to EDGE and loads a given aspx file in an iframe,
thus forcing it to be rendered using the browser's latest rendering engine.
Usage: ie.aspx?file.aspx
The default page to be loaded, when this file is accessed, can be set below (url variable).
(c) 2015 | Paul Tavares (@paul_tavares)
Blog post:
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<link rel="shortcut icon" href="/_layouts/15/images/favicon.ico" type="image/" />
<link rel="shortcut icon" href="/_layouts/images/favicon.ico" type="image/" />
<body style="margin:0px;overflow:hidden;">
<script type="text/javascript">
(function(window, document, location){
var iframe = document.createElement("iframe");
iframe.src = (function(){
var url = ""; //<-- Set this to the page you want to be loaded by default when user accesses this file.
if ( && > 1) {
url =;
} else {
if (!url) {
alert("No page to load!\nUsage: ie.aspx?pageToLoadHere.aspx");
location.href = (
location.href.indexOf("?") > -1 ?
location.href.substr(0, location.href.indexOf("?")) :
location.href.indexOf("#") > -1 ?
location.href.substr(0, location.href.indexOf("#")) :
) +
"?" + url + location.hash;
if (location.hash) {
url += location.hash;
return url;
if (!iframe.src) {return;}
iframe.hidefocus = true;
iframe.scrolling = "auto";
iframe.setAttribute("style", "border:none;width:100%;height:" + window.innerHeight + "px;");
window.addEventListener('resize', function(){"height", window.innerHeight + "px");
if (iframe.contentWindow.location.hash !== location.hash) {
location.hash = iframe.contentWindow.location.hash;
}, 500);
}(window, document, location));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.