capture url in href tag
I have an exit page that informs users that they are leaving my site. How do I capture the intended url from the referring page and send the user to it once they've acknowledged on the exit page that they're aware they're leaving my site and wish to continue to their destination? My current setup works with an absolute link but not with a relative path.
this works:
href="http://acme.com/company/brand/leaving/?url=http://www.about.info/choices/
this doesn't:
href="../COMPANY/BRAND/leaving/?url=http://www.about.info/choices/"
the continue button triggers the following function:
function gbye(){
var url = window.location.toString();
var url_arr= url.split("?url=");
if(url_arr.length>1)
{
try
{
window.location = url_arr[1];
}
catch (e)
{
}
}
return false;
}
can anyone explain why the href with the relative开发者_运维百科 path doesn't work (returns a directory list) and how I can make the relative path work?
Most servers are running under a Linux environment, where the filesystem is case-sensitive, ie file names with different cases are treated different.
If the first link worked correctly, use ../company/brand/leaving/?url=...
. I recommend using a /
(absolute root) instead of ../
, because you won't have to edit your files when you move the files to a different directory, when using /
.
精彩评论