I'm using GreaseMonkey in FireFox with the following code
if (window.opener)
{
alert(window.opener.location.href);
}
However, i'm getting a Permission Denied
error, possibly due to cross-domain policy. How do i overcome this protection?
I'm using GreaseMonkey in FireFox with the following code
if (window.opener)
{
alert(window.opener.location.href);
}
However, i'm getting a Permission Denied
error, possibly due to cross-domain policy. How do i overcome this protection?
You can't do this if the window is on a different domain than its opener. For plain javascript, blocking this information is considered a security safeguard.
For Greasemonkey, it might be less of a security problem, but the Greasemonkey devs have not added that capability. Greasemonkey is just plain javascript, with select, limited, extension capabilities added on.
You can open a feature request for for this, but it is unlikely to be approved unless you can make a good case for both: how this is useful, AND how it won't result in careless GM users being "pwned".
In the meanwhile, you can always fork the Greasemonkey source code and build your own version that breaks the cross-domain barrier.
Or, depending on what you are really trying to do, there may be a workaround involving two or more script instances communicating. Open a new question and describe the scenario, in full detail, for help with a workaround.