Javascript 为所有外部链接Blogspot创建重定向页面

Javascript 为所有外部链接Blogspot创建重定向页面,javascript,html,url-redirection,blogger,blogspot,Javascript,Html,Url Redirection,Blogger,Blogspot,我想在离开我的网站时,将一些外部链接重定向到我的特定页面。 我以前尝试过safelink,但它需要创建其他新博客来重定向所有外部链接 我的意思是,例如: https://updated2apks.blogspot.co.id/2017/09/whats-different-100-mod-apk.html 如果单击外部链接,它将重定向到特定页面 https://updated2apks.blogspot.com/p/your-apk-is-ready-for-download.html?id=c

我想在离开我的网站时,将一些外部链接重定向到我的特定页面。 我以前尝试过safelink,但它需要创建其他新博客来重定向所有外部链接

我的意思是,例如:
https://updated2apks.blogspot.co.id/2017/09/whats-different-100-mod-apk.html

如果单击外部链接,它将重定向到特定页面

https://updated2apks.blogspot.com/p/your-apk-is-ready-for-download.html?id=com.qs.whatsdifferent.html

最后,离开博客,转到目标链接(外部)
因为这是Blogspot平台,所以我试着在谷歌上搜索,但缺少教程。我希望这里的人能帮助我。

如果我正确理解您的问题,这是一个可能的解决方案,它将首先将页面重定向到您的页面,而不是外部页面。
(这必须在主题中完成)

这里有一个例子:
(如果外部url使用参数,则必须调整代码)

所有代码都使用Chrome 60进行了测试+


我的问题解决了你的问题,还是我遗漏了什么?
<script>
    // Here we check if the current page is the redirect catch page
    if("http://URL_THAT_SHOULD_CATCH_REDIRECTS.html" === "<data:blog.url/>")
    {
        // Here we assume there is only one parameter in the URL, with our external Link
        var parameter = location.search.split(/\?|=/g).slice(1);
        // Here we check if the size of the array is valid, checking for the parameter name would be also good. Maybe even checking if the passed URL is valid
        if(parameter.length===2){
            // Here we redirekt to the URL that is the Value of the passed parameter
            location.href=parameter[1];
        }

     }
</script>   
document.getElementById("aLinkId").addEventListener("click", function(e){
    e.preventDefault();
    // Here we redirect to the wanted page, with the extra parameter, with the original external URL
    location.href = "REDIRECT_URL?redirect="+ document.getElementById("aLinkId").href; 
});