js截取url参数 网站广告跳转安全警告提示html单页面源码

【Q站】网站广告跳转安全警告提示单页面源码 作者 百变鹏仔

使用教程

    下载模板,放置到服务器或者主机空间,通过域名访问,如 网址/jinggao.html?tpurl=

    tpurl= 后跟需要跳转的地址,例如 http://iqzhan.com/jinggao.html?tpurl=http://iqzhan.com

    

    http://iqzhan.com/jinggao.html + ?tpurl= + 广告地址

    访问后,会先到警告页面,等待3秒后,会自动跳转至广告地址。用处不是很大,主要就是提示用户,这是第三方广告,交易请谨慎,第三方广告与本站无任何关系。

原文地址 http://iqzhan.com/post/123.html

<script>
	// 获取当前url地址
	var url = window.location.href;
	// 截取传递的url参数
	url = url.match(/tpurl=(\S*)/)[1];
	document.getElementById("UrlId").href = url;
	// 获取秒数显示id
	var seconds = document.getElementById("seconds");
	// 设置秒数
    var num = 3;
    var timer = setInterval(function () {
        num--;
        seconds.innerText = num;
        if(num == 0){
            window.location.href = url;
        }
    },1000)
</script>

demo下载 https://lanzous.com/icbwkpa

posted @ 2020-05-22 15:38  鹏仔先生  阅读(24)  评论(0)    收藏  举报  来源