IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes how to get url Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "how to get url" Watch "how to get url" New topic
Author

how to get url

santhoshkumar samala
Ranch Hand

Joined: Nov 12, 2003
Posts: 156

Hi
how to get url of a page in javascript when we have frames? when I am using window.parent.location I am getting url but if apply any method let us say "window.parent.location.length" then it is not giving length, why it is so? can any body please help me


santhosh<br />SCJP,SCWCD
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
theMainURL = parent.document.location.href;
Rose Shahi
Greenhorn

Joined: May 06, 2004
Posts: 2
Dear Friends,
I am using following code.
------------------------
var url=parent.document.location.href
window.open('refer.php?url='+url,'Refer','status=no,location=no,scrollbars=yes,width=450,height=200')
-----------------------------
But i am not getting full url [http://localhost/ghale/itinerary_detail.php?page=Trekking&sid=20] due to use of "&" in url.
Anybody knows the solution.
Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
did you alert what the url string is to see if it was grabbing all of the data?

Is it the full URL? Most likely so!
The real problem is that you are mixed fire and water with two query strings in one url in the pop up window, so it is dumping the data most likely from the second query string.
you most likely will have to escape the first url before adding it to the pop up url.

Eric
Rose Shahi
Greenhorn

Joined: May 06, 2004
Posts: 2
Thanks
escape function really works for me.
Once again thanks.
 
 
subject: how to get url
 
Threads others viewed
application flow
Applet Button
crawler help
Not able to redirect from servlet when called from applet
LoginFilter & j_security_check
developer file tools