Solved

Can I read IE address bar?

Posted on 2001-08-03
10
363 Views
Last Modified: 2008-03-04
Hi,

is it possible with javascript/vbscript to get what's in IE address bar(the URL field)?
I don't mean document.location.href, but the text from the address bar.

Thanks
0
Comment
Question by:sphere301
10 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6347842
Eh?

I'm afraid you've lost me....

And it is window.location not document.location.

:o)

Ant
0
 

Expert Comment

by:isond
ID: 6348115
Do you mean the bar at the bottom of the explorer window that displays links when you hover over them?
0
 

Expert Comment

by:raghu_hale
ID: 6348328
need some more info..
0
 

Author Comment

by:sphere301
ID: 6348480
No, I mean the address bar which usually stays at the top of the browser window and where you enter the url you want to visit. For example, my address bar now shows
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=javascript&qid=20162676

0
 
LVL 8

Accepted Solution

by:
bebonham earned 100 total points
ID: 6348504
no...

you can't read the text from there.

when you read location, you are loading the page that is currently loaded in the browser.

9/10 times that is the same is in the address bar...but if I typed foo in the the address bar, and then clicked a button on my page that had onclick=alert(window.location.href)
I would not get foo

I think you are wanting to see what page someone leaves to?
which I don't believe possible through javascript alone

hope that helps

Bob
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:Droby10
ID: 6350720
the location object is bound to both the document and window in IE (this provides sourced elements with their own location object)...but this reference should not be used if cross-compatibility is an issue; it will work with netscape up to at least 4.0 (even though they suggest using document.URL)

...because netscape 6 has yet to implement LiveConnect i don't program for the environment and couldn't even begin to tell you what would be the appropriate usage.  it's always a safe bet to use window.location if you're not needing to change or fetch location objects from sourced elements.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6353225
document.URL will get you the URL string for the current page. Carries any querystring too.

You can't WRITE to that, it's a read-only object.
0
 

Author Comment

by:sphere301
ID: 6538499
I don't want to write to the URL field, I just want to check what's in there. This may not be the same as the url of the currently loaded document because after the page loads you can type there whatever you like and the same page will be still loaded
0
 
LVL 12

Expert Comment

by:ahosang
ID: 7955560
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
points to bebonham
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ahosang
EE Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8001015
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now