I use the window.open(url, target)
to open a url
in a new tab/window. Before doing that, I set some properties on the newly opened window object with the intention of passing data from this page, the creator of the new window, to the newly created window.
In all browsers except Internet Explorer, the code works fine. The newly created page is able to read back the properties from the global window
object representing its window.
However, only in Internet Explorer 11, the window
object in the newly created window does not have the properties passed in by the previous page.
Below is example code demonstrating the problem.
Page1.html
<script type="text/javascript">
function openNewPage(value1, value2)
{
var newWindow = window.open('Page2.html', '_blank')
newWindow.property1 = value1;
newWindow.property2 = value2;
}
</script>
Page2.html
<body onload = "bodyLoadHandler()">
<script type="text/javascript">
function bodyLoadHandler() {
// Both of these returned undefined
// whether referenced explicitly
// as window.property1 or as
// this.property1. I prefer the explicit
// window.property1 way because of the screwed up
// this pointer and its ensuing issues in JavaScript.
// This happens only
// in IE. The code runs fine in other browsers.
var property1 = window.property1;
var property2 = window.property2;
}
</script>
</body>