Skip to content

Instantly share code, notes, and snippets.

@jebai0521
Last active September 15, 2015 02:33
Show Gist options
  • Select an option

  • Save jebai0521/809dbe79a0f37c3d122c to your computer and use it in GitHub Desktop.

Select an option

Save jebai0521/809dbe79a0f37c3d122c to your computer and use it in GitHub Desktop.
自动打开新的页面
<script type="text/javascript">
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
var timer = setInterval(function(){
clearInterval(timer);
var a=document.getElementById("ipa");
var dispatch = document.createEvent("HTMLEvents");
dispatch.initEvent("click", true, true);
a.dispatchEvent(dispatch);
},
1000 //延时
);
} else if (/(Android)/i.test(navigator.userAgent)) {
var timer = setInterval(function(){
clearInterval(timer);
var a=document.getElementById("apk");
var dispatch = document.createEvent("HTMLEvents");
dispatch.initEvent("click", true, true);
a.dispatchEvent(dispatch);
},
1000 //延时
);
} else {
var timer = setInterval(function(){
clearInterval(timer);
window.open('http://www.sammyun.com');
},
1000 //延时
);
};
</script>
<a id="ipa" class="hide" href="https://itunes.apple.com/us/app/xiao-shu-tong/id998300098?l=zh&ls=1&mt=8"></a>
<a id="apk" class="hide" href="https://dev.xxx.com.cn/p/xiaoshutong.apk></a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment