Solved

Can I read IE address bar?

Posted on 2001-08-03
10
368 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
allow link tag to be submit like form 15 60
Check if field exists SPUtility 5 48
hide and show spans from dropdown selection 3 38
Check for Numeric Phone Field 14 48
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

739 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