javascript - Internet Explorer throws SCRIPT5022: HierarchyRequestError when trying to appendChild an HTML object from another window -


i have html table 1 window. table using

var table = document.getelementbyid('tableid'); 

then open window using :

window.open('newwindow.html');  

in window, there's div id = divid.

now if tried append table other window following code :

var clonetable = jquery.extend(true, {}, window.opener.table);  var div = document.getelementbyid('divid');  div.appendchild(clonetable); 

internet explorer throw error :

script5022: hierarchyrequesterror

i have searched error code, listed here :

http://msdn.microsoft.com/en-us/library/ie/gg592979(v=vs.85).aspx

it said can't insert node @ location. however, above code works fine in firefox , chrome.

what's happened here , how can work around ?

thanks,

p.s: i'm using ie 10

ie can't move elements across different documents. can user outerhtml property if browser fails clone table.

e.g.

var tbl = window.opener.table; try {     document.getelementbyid('my_div').appendchild(tbl.clonenode(true));  } catch (e){     if (tbl.outerhtml) {         document.getelementbyid('my_div').innerhtml = tbl.outerhtml;     }     else {             console.log('not working');     } } 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -