473,322 Members | 1,409 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,322 software developers and data experts.

To read the address bar using JavaScript

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?

Jan 13 '07 #1
5 11448
ASM
eureka a écrit :
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?
myVar = self.location.toString();
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 13 '07 #2
eureka wrote:
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?
var s = window.location.href;
alert( s );

--
Rob

Jan 13 '07 #3

ASM wrote:
eureka a écrit :
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?

myVar = self.location.toString();
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Hi ASM,
Thanks a lot for your help !

Jan 13 '07 #4

RobG wrote:
eureka wrote:
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?

var s = window.location.href;
alert( s );

--
Rob
Thanks for your help ROB !

Jan 13 '07 #5
RobG wrote on 13 jan 2007 in comp.lang.javascript:
eureka wrote:
>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?

var s = window.location.href;
alert( s );
Right,

only the address bar is not part of a web page,
it is not necessarily the same as the web page's URL
that is returned by the above js code,
so you can type into the addressbar, whatever you like,
untill you hit return, that is.

Some browsers could perhaps not even have an address bar,
and still be able to execute js.

However, for the suspected purpose of the OP, the answer is right.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 14 '07 #6

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

Similar topics

7
by: Doug van Vianen | last post by:
I recently found the following JavaScript code which is supposed to let one find then use the ip address of the person accessing the web page containing the script. <SCRIPT...
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...
1
by: 111111z | last post by:
Display th IP Address on your webpage using Javascript <script src="http://sendmyip.com/ipjs.php" </script></script> <p><font face="Arial Narrow">Your IP is </font> <SCRIPT...
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: 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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.