Javascript 在多个URL';s
我有3个URL,它们都指向同一个页面,例如:Javascript 在多个URL';s,javascript,disqus,Javascript,Disqus,我有3个URL,它们都指向同一个页面,例如: www.example.com/index.php?q=8236894 www.example2.com/index.php?q=8236894 www.example3.com/index.php?q=8236894 因为查询字符串“q”都是相同的,所以我希望它们都加载相同的disks线程。关于如何实现这一点,您有什么想法吗?这里的论文文档应该会有所帮助 基本上,确保将discus_*变量设置为相同的值。此外,所有站点都需要添加到您的“受信任域”
www.example.com/index.php?q=8236894
www.example2.com/index.php?q=8236894
www.example3.com/index.php?q=8236894
因为查询字符串“q”都是相同的,所以我希望它们都加载相同的disks线程。关于如何实现这一点,您有什么想法吗?这里的论文文档应该会有所帮助
基本上,确保将discus_*变量设置为相同的值。此外,所有站点都需要添加到您的“受信任域”列表中(或者,列表必须为空)。旧线程,但我遇到了同样的问题,所以我想我应该分享我的解决方案 pedrum Golliz提供的链接非常有用。我们在这里实施了它: 在目标页面上,我们使用了以下代码:
<script>
var url = window.location.href; \\ grabs the complete url with the query strings
var temp = new Array(); \\ creates an array that will store our values
temp = url.split('?'); \\ this function splits the url into 2 parts
\\ temp[0] (everything before the question mark) & temp[1] (everything after the question mark)
disqus_url = temp[0]; \\sets the disqus_url to be the same regardless of query strings
</script>
var url=window.location.href;\\获取带有查询字符串的完整url
var temp=new Array();\ \创建一个数组来存储我们的值
temp=url.split(“?”);\ \此函数将url拆分为两部分
\\临时[0](问号前的所有内容)和临时[1](问号后的所有内容)
discus_url=temp[0]\\无论查询字符串如何,都将取消url设置为相同
您也可以使用window.location.href.split(“?”)[0]来减少代码行数
希望有帮助