<script>
/* by qidizi: discuz 不允许跳转到其它域名,现使用js处理,减少修改的工作量,允许跳到同顶域--不能跳到其它域,防止仿站之类的欺骗*/
(function(){
var topDomain = location.host.split('.');
topDomain = topDomain[topDomain.length-2]+'.'+topDomain[topDomain.length-1];
if (location.hash.length < 3) return location = 'http://' +location.host + '/';
var referer = unescape(location.hash.replace(/#/g, '').replace('%_', '%'));
if (new RegExp('^http\\:\\/\\/([^\\/]+\\.)?' +topDomain+ '\\/', 'i').test(referer)) {//同top domain
location = referer;
} else {
location = 'http://' +location.host + '/';
}
})();
</script>
使用方式如下.使用js生成的一个退出链接,点击退出成功再会退出当前的这个页面.这样这个目的就达到了.
+ ' <a href="http://bbs.qidizi.net/member.php?mod=logging&action=logout&formhash=' +json['formHash']+ '&referer=/referer.htm' +escape('#') +escape(location).replace(/%/g, '%_')+ '" target="_self">退出</a>'
ok,经过测试.此方案工作正常
本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。
本文地址:http://www.xlkjgs.com/notes/web/463.html