• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while manipulating parent window URL in child window

 
Amit K Jain
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to split the parent URL taken in child window to get a sub string out of it. If I use 'window.opener.document.location' to get the parent url and call split method it gives me the error below

Line: 15
Char: 1
Error: Object doesn't support this property or method
Code:0
URL: http://localhost:9085/EPOApp/epo_child.jsp


I am launching the jsp from the html parent window.

My jsp code for child window:


Can someone please help on this?

Thanks
Amit
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would expect window.opener.location.href or window.opener.location.search

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you debugged what the variable holds before you split it? console.log is your friend.

Eric
 
Amit K Jain
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Thanks you for your reply.

Yes. It is resolved by using 'window.opener.location.href'. I could print the value in alert for 'window.opener.location' which looks as expected hence moved on to split it. I do not have the right utility to debug the JS code and unfortunately I haven't done much work on JS. Can you please point me to any utility for it, any plugins in FireFox and its user guide?

BTW after making 'window.opener.location.href' working I notice that I can get the URL for parent window using 'window.opener.location.href' only when the parent and child window are running on same server and same application context. It doesn't work if they are in cross domain.
e.g.
this is the parent URL: http://localhost:9083/support/openair_test.html?uid=3PsN9DoC4hGRxiqe0PJLMg;app=rm;r=6Mcykfw3198;action=edit;save_action=paint;booking_id=50401
The Child page : http://localhost:9085/EPOApp/child.jsp

Could you please advise if this is feasible in javascript or is there any way to achieve this?

Thanks
Amit
 
Amit K Jain
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. So I tried document.referrer to get parent URL which resolved the issue.

Thanks
Amit
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are doing web development and you do not know about Firebug?

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic