Forum Moderators: open

Message Too Old, No Replies

Stop a javascript redirect?

They are using (parent.opener.location)

         

AssertiveWD

11:31 pm on Dec 26, 2007 (gmt 0)

10+ Year Member



They are using a javascript function:

code:
<script>
if (parent.opener.location) {
parent.opener.location = "http://domain.com/";
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);
}
</script>

How would I go about stopping this from taking effect? Any nullifying code I can use to disallow Javascript redirecting?

Currently they are doing this without my permission, but if I can stop it I won't mind.

When I open a new window instead of a tab, it does not happen to the starting page in either browser.

Help here would be greatly appreciated.

Thank's for the advice

coopster

1:43 am on Dec 27, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, AssertiveWD.

parent.opener.location
If a window does not have a parent then it's parent property is going to be a reference to itself. Not much you can do here.

parent.opener.location
When a window is opened from another window it maintains a reference to that first window in the

opener
property of the DOM
window
object. If the current window has no opener, the opener method returns NULL.

parent.opener.location
Returns a Location object which contains information about the URL of the document. However, if the opener was NULL, then this is going to obviously return a false value to the if statement in the corresponding JavaScript you provided.

I would probably focus on that "opener" property.

<added>
I was going to ask if you were using target="_blank" ;)
[webmasterworld.com...]
</added>

Achernar

2:19 pm on Dec 27, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



Can you send a PM with the url.

Thanks