Click to See Complete Forum and Search --> : How to get the URL in the address bar ?


balkanski
12-21-2005, 04:58 AM
Hi to all. I've got one tricky question. How can I get the value of the address bar of the browser? But the tricky stuff is that I don't want to get the address of the current page (with document.URL or window.location.href) but the new URL that I will type there. Here is my idea, in order to understand my goal. I have one page that has 'onUnload=func()' in its body. When I type an URL in the address bar and hit 'Enter' the onUnload is triggerred and func() is executed before the new page loads into the browser. I want to get the URL that i've just typed in func() and to make some operations over it. Can anybody help me, because I made a wide research on the internet but nothing came up and I'm starting to tnihk that my goal looks pretty impossible to achieve.

Thanks to all.

bathurst_guy
12-21-2005, 05:00 AM
I believe that it is impossible. If a browser or a script were allow you to do this then it would be a breach of security.

Kor
12-21-2005, 05:03 AM
onbeforeunload is the proper event

Anyway, it woun't work, for a simple logical matter: onbeforeunload and onunload are events that occures before the page is left, nomatter the reason, so that there is no way to find out the new addresss typed in the address bar, as it is a subsequent action.