IE7 and parent.location not working?

This is a discussion on "IE7 and parent.location not working?" within the JavaScript Forum section. This forum, and the thread "IE7 and parent.location not working? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 20th, 2007, 14:08
New Member
Join Date: Apr 2007
Location: Dublin
Age: 29
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
IE7 and parent.location not working?

Hi,

In a script used by svg, I have a like like the following to go to a new web page:

Code: Select all
parent.location.href = newUrl;
This works fine in IE6. However, it has no effect in ie7 (not even a error message, or security message) It just does nothing.
I have noised when i do:

Code: Select all
alert(loc + "?" + entityName);
parent.parent.location = loc + "?" + entityName;
alert(parent.parent.location.href);
values displayed by alert are not the same!!! parent.parent.location was not overwritten.

(I tried window.location=, window.assign(newUrl), parent.location.href, parent.location= .... none of it works, and I don't get an error message)

Is this expected behavior in ie7? Is this a security thing? Where is there information on this?

Thanks,
MR

Last edited by camer38; Apr 20th, 2007 at 14:33. Reason: Please use [code]...[/code] tags when displaying code!
Reply With Quote

  #2 (permalink)  
Old Apr 20th, 2007, 14:59
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: IE7 and parent.location not working?

why are you using parent? are you using frames?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #3 (permalink)  
Old Apr 23rd, 2007, 08:21
New Member
Join Date: Apr 2007
Location: Dublin
Age: 29
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: IE7 and parent.location not working?

Hi

I use frames and I regret that it could not be changed. It is a part of a bigger application.
I would be grateful for any suggestion or workaround.

Cheers,
MR
Reply With Quote
  #4 (permalink)  
Old Apr 23rd, 2007, 11:34
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: IE7 and parent.location not working?

Very strange...
I found this...
http://lists.macosforge.org/pipermai...ry/003915.html
...which doesn't apply to IE but suggests there may be security restrictions when executing cross-frame js.

have you tried having a 'receiving' function in the target frame?
I mean, instead of...
parent.parent.location='test1.html'
...try...
parent.parent.GO('test1.html');

Then in the parent.parent document, have a function like this:
function GO(loc){
window.location = loc;
}

that way, if there's a restriction on changing the location of a separate frame, you work around it by sending a parameter to that frame and the code within the target frame will change its own location.

does that make sense?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #5 (permalink)  
Old Apr 24th, 2007, 07:17
New Member
Join Date: Apr 2007
Location: Dublin
Age: 29
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: IE7 and parent.location not working?

I was able to work around the problem by having a script in my page that was called from svg.

You can call a script function that resides on the page from a svg script.

I just put a function like

Code: Select all
gotoUrl(u) { parent.location.href = u; }

on the main page and called this from SVG.

Thank you very much for your suggestion , it puts me on a right tracks.

But it is a workaround, I still do not understand the couse of the problem.
Reply With Quote
  #6 (permalink)  
Old Apr 24th, 2007, 11:13
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: IE7 and parent.location not working?

It's more than just a work around, it's best practice. Having some code in the frame you want to control implies the frame is allowing you to control it - if you see what I mean...
follow this iead and you should not run into trouble again...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
ie7, parentlocation, svg

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
co-location tankara Hosting & Domains 5 Jan 18th, 2008 07:54
Search by location andrwcris Website Planning 1 Sep 11th, 2007 17:33
Need to Trace this Location Map davva Graphics and 3D 4 Aug 31st, 2006 19:08
parent daughter maxelcat Web Page Design 3 Aug 14th, 2006 23:34


All times are GMT. The time now is 19:12.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43