开发者

capture url in href tag

开发者 https://www.devze.com 2023-04-07 09:58 出处:网络
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

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 /.

0

精彩评论

暂无评论...
验证码 换一张
取 消