DOM tree limitations in window.opener in IE10 using javascript?

Discussion in 'JavaScript Forum' started by pinuitradonna, Apr 9, 2013.

  1. pinuitradonna

    pinuitradonna New Member

    Okay, so I downloaded IE10 and immediately ran into some issues already...Imagine the following situation. We have a parental window, containing HTML:\[code\]<!DOCTYPE html><html> <head> <script> function doAction() { var win = window.open('child.htm', '', ''); } </script> </head> <body> <a href="http://stackoverflow.com/questions/15905159/#" onclick="doAction();">Click here to open window</a> <div id="obj"><span>A new element should appear: </span></div> </body></html>\[/code\]If you click on the link, then it will open a window containing HTML:\[code\]<!DOCTYPE html><html> <head> <script> window.onload = function() { var span = document.createElement('span'); span.innerHTML = 'it works!'; try { window.opener.document.getElementById('obj').appendChild(span); } catch(e) { alert('Exception was thrown: ' + e); } }; </script> </head> <body> </body></html>\[/code\]I have tested this in a lot of browsers (FF, Chrome, IE etc). The text 'it works' appears, like it should. Except for IE10, in which it gives an alert:\[code\]'Exception was thrown: HierarchyRequestError'\[/code\]My question is, what is the best way to solve this?I could of course pass the child to a function in the window.opener, but this does not work either. It seems as if I can only add a child to a window in which it is created. Correct?I would also like to know why this has changed, it is hard to find anything about this exception.
     

Share This Page