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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opposite of document.referrer

Status
Not open for further replies.

KDavie

Programmer
Feb 10, 2004
441
US
I am trying to figure out a way to save a target url to a variable on the unload event so I can past it as a postback __eventargument.

Unload event code:

Code:
<script language="Javascript">
	function Save(){
	var url = [b]Code to get target url[/b]
			window.execScript(__doPostBack("RemoveLocks", url))
			}		
		</script>

I am using the page_load event to call a server-side method used to remove records locks... A little unorthodox I know, but the only work around I could think of to solve my dilema of lingering record locks due to users manually leaving a page instead of clicking the "Done" button that would normally remove the locks.

Any suggestions on how I can get the target URL using javascript?

(This is an Asp.NET web app with vb.net code behind.)

thanks in advance
 
If the user leaves the page via an anchor, you could populate the "url" valriable with "this.href" in the "onclick" event handler for each link (you can easily set this with some JS).

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks for the qwick reply. I'm afraid that doesn't really solve my dilema.

I need a way to get the url the user is trying to navigate to from the unload event, even if the user manually types a new url in the browser. Does this make any sense?

Thanks
 
I figured so much.....


Thanks though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top