Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Findin the http link or URL to which a page is navigating ??

Status
Not open for further replies.

transtec

MIS
Nov 1, 2005
71
0
0
LK
Hi all,

I'll be using this information in the "onunload" event of the page. When a user submits or closes the page or visits a new link the onunload event will be fired and in this event I want to capture that new link he is about to visit.

I tried using "location.href" but that only gives me the link in which the user is currently in. Not the link that he is about to visit !

How do I find this URL that he' about to visit in the onunload event, using what command ?

thanx a lot.
 
If the page the user is leaving is your page, then add an onclick to all links that stores the href attribute in a global variable when clicked.

Or, another way would be to simply call a function from the onclick event of each href, and determine in that function whether the link is external or not.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanx for the help ,

But problem is, this functionality is not for a page Im creating. I actually need this so that I cud embed the javascript functioality to any page on the thus be able to have control over the way they submit to the server.

Im really building a special kind of proxy server with "special requirements". Whenever a web page that the user is visiting, submits or browse to any other page or anything like that happens, I need to notify the proxy server about it. ( Iam gathering information about the time spent etc ). Since I am building a proxy server I hope to embed all the web pages that are served through that Proxy, with this javascript code snippet..

So Im hoping to use the onunload event and through that, pass the link that the user is "submitting to" or "is about to visit to" to the Proxy Server and then let the proxy server fetch the new link, whilst making a note of the parameters of the request.

But as I said before, I used location.href in the onunload event but that will only show the link of the page that the user is currently in, NOT the one THAT HE IS ABOUT TO VISIT !

Is there a property for this, jus like there is for location.href to show the current page ?

adios.
 
If you're building a proxy server, surely you would do all this detection in the proxy code itself?

It will be aware of all pages loaded through it, and so can keep track of the stats you're asking for.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top