473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to read the url from address bar in javascript

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

Oct 27 '05 #1
4 9945
> 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?

Oct 27 '05 #2
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?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 27 '05 #3

"srinivas" <ni********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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
Oct 27 '05 #4
VK

Zwerfkat wrote:
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?

What really OP has in mind is (my best guess):

<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/edbd370312cb3273/cb5391d700302eda?hl=en#cb5391d700302eda>

Are we making content grabber and hiting to crossdomain security
restrictions?

(My deep apologies if I was wrong)

Oct 27 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Reply Via Newsgroup | last post by:
Folks, I'm pretty sure it can be done, and I'm doing pretty good with my javascript so I'm pretty sure I just need a quick point in the right direction... If my web page is referenced in the...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
2
by: catronro | last post by:
I want to read an xml file and build a string based on that file. But when i try to implement it i get an Object Required error. Any help would be greatly appreciated. try { var xmlDoc = new...
0
by: rascal_mon | last post by:
I'm new with XML. Please give me some advice. I wonder there are any difference between XML that is automatically generated from ADO and XML file that shows in many textbooks. I found that the...
3
by: dan.cao.nguyen | last post by:
OK, I've basically copied this code ad verbatim from a book to test...what I have is an index.html page that refers to "map_data.php" and "map_functions.js"... map_data.php draws some...
4
by: Kuldeep | last post by:
Hi All, I am trying to read the contents of a page through its URL. My code snippet is as follows: public void mtdGetPageDataHWR() { HttpWebRequest objRequ =...
5
by: eureka | last post by:
Hi All, I need to store the address-bar content of a web page into a string variable , Is there any way I can achieve this through JavaScript?
15
by: Evil Otto | last post by:
My page loads, and calls an init() function that returns content to a div on the page, as well as setting a $_SESSION variable. The content it returns includes a link that calls the same variable,...
5
by: subbulakshmi | last post by:
hi how to read data from XMLDocument by using Javascript. i got coding from internet. but its not read data. help me its in JavaScript ----------------------- //server return XML...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.