I have a question regarding method window.open(...) or open(...).
If i use this method to open a new window, is it possible to use DOM to append objects to that same window, or is it restricted.
I have been searching for foruns and web in general, there seems not having a straight answer.
Giving an example, with an event Listener i detect the keypress "Enter", which in then it triggers the opening of a new window with the intended page, in this case the same page, but i wanted to change some parts of it by adding objects to it (append them).
Expand|Select|Wrap|Line Numbers
- newWindow = window.open('test.html','newWindow','width=640,height=480,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
- var tmp = newWindow.document;
- var divAll = containerDiv = document.createElement('DIV');
- divAll.id = "area-"+Number;
- divAll.style.height = 45+"px";
- divAll.style.width = 45+"px";
- divAll.overflow = "scroll";
- divAll.overflow.x = "hidden";
- divAll.overflow.y = "auto";
- var containerDiv = document.createElement('DIV');
- containerDiv.id = "div_"+Number;
- containerDiv.name = "original";
- containerDiv.style.height = 45+"px";
- containerDiv.style.width = 45+"px";
- containerDiv.style.position = "absolute";
- var project = document.createElement('IMG');
- project.id = "projecto_"+number;
- project.numero = number;
- project.style.height = 45+"px";
- project.style.width = 45+"px";
- project.style.position = "absolute";
- project.setAttribute('src', "7656756.jpg");
- containerDiv.appendChild(project);
- divAll.appendChild(containerDiv);
- tmp.getElementById('myArea').appendChild(divAll);
Is it possible to use a page to call itself with the method window.open(...) and then use DOM to change its content ? Or is it a restriction or problem with same Origin Policy ?
Thank You