中国·深圳
壹品红 - 专注网站托管服务10⁺年
壹品红 - 专注网站托管服务10⁺年

根据访问域名,来路域名,JS判断显示不同的内容

<script type=”text/javascript”>
if(location.host.indexOf(“jitailed.com”)!=-1)
document.write(‘<script type=”text/javascript” src=”a.js”></scr’+’ipt>’);
if(location.host.indexOf(“geety.cn”)!=-1)
document.write(‘<script type=”text/javascript” src=”b.js”></scr’+’ipt>’);
</script>

// 判断域名的操作:如果域名是qblog 或qdownload,则为true;
var flagBox1 = window.location.host.indexOf(‘qblog’)>=0 ? ‘true’:’false’
var flagBox2 = window.location.host.indexOf(‘qdownload’)>=0 ? ‘true’:’false’

 

<script type=”text/javascript”>host = window.location.host;if (host==”www.adminwl.cn” || host==”www.demo.cn” ){window.location.href=’www..cn’;}if (host==”来路域名” || host==”来路域名”){window.location.href=’你想展现给用户的网址或目录’;}</script>

更多:https://knife.blog.csdn.net/article/details/121778515

需要帮助吗?请加客服微信

推荐阅读:

您使用的浏览器无法保证网站的正常运行,请使用新版浏览器并选择高速模式。

下载Microsoft Edge

Hi,有什么可以帮到您?

工作时间 (GMT+8) 9:00~17:30 周一至周五