how to read the url from address bar in javascript

S

srinivas

Hi,

My requirement is like this.We have one page called page1.html
in this page we have one iframe.in the i frame we put height and width
as 100% and src=page2.html.In the address bar i am able to see
page1.html in the page(i frame) we are seeing page2.html, now what i
need is if i read the url i need to get the page1.html path.can anybody
please send me the javascript or aspx code for this.

Thanks,
Srinivas
 
J

Joshie Surber

My requirement is like this.We have one page called page1.html
in this page we have one iframe.in the i frame we put height and width
as 100% and src=page2.html...

You aren't exactly clear what you need here. Can you post a URL where
this exists?
 
Z

Zwerfkat

srinivas said:
Hi,

My requirement is like this.We have one page called page1.html
in this page we have one iframe.in the i frame we put height and width
as 100% and src=page2.html.In the address bar i am able to see
page1.html in the page(i frame) we are seeing page2.html, now what i
need is if i read the url i need to get the page1.html path.can anybody
please send me the javascript or aspx code for this.

Thanks,
Srinivas


When you are inside the iframe (page2), you can access the url from the parent window (page1) as
follows:

url = parent.window.location.href

Is this what you had in mind?


Regards,

Frans
 
R

Randy Webb

srinivas said the following on 10/27/2005 3:49 AM:
Hi,

My requirement is like this.We have one page called page1.html
in this page we have one iframe.in the i frame we put height and width
as 100% and src=page2.html.In the address bar i am able to see
page1.html in the page(i frame) we are seeing page2.html, now what i
need is if i read the url i need to get the page1.html path.can anybody
please send me the javascript or aspx code for this.

parent.location.href from page2.html will give you the URL of the main
page with the IFrame in it. That is assuming that they are from the same
domain.

Or, is it something else you are wanting to get?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top