Next, I have a page that, when you click a button, opens a new window. In this new page I would like to put links that affect the page that generated this window.
Does anyone know how to do it?
Next, I have a page that, when you click a button, opens a new window. In this new page I would like to put links that affect the page that generated this window.
Does anyone know how to do it?
If the tab is in the same domain you can access the parent page that opened through window.opener
. If it's different domains it will forbid you from accessing document
in most browsers.
function alteraPaginaPai() {
window.opener.document.getElementById('lbl').innerHTML = "Alteração!!"
}
In the two articles below you will see how you can drill down into the properties of the window
object in JavaScript
Exploring the properties of the window object in JavaScript
Advanced operations with Javascript popups
strong> As a brief example, you can use within pop-up
or iframe
window.parent
to access variables and functions from the main browser window.
In the target option you have the following options: _blank _parent _self _top framename
<a href="http://www.google.com" target="_parent">Visit google.com!</a>
And what you want is parent. Hope this helps. cumpz