|
|
本帖最后由 WPRAIN3 于 2015-6-16 11:25 编辑
各位大拿好,小弟想更好的利用每个点击,想实现“用户在打开LP后进行后退或关闭当前LP的操作时,浏览器跳转到新的LP”这样的功能,不知道什么代码可以实现?
下面这段代码似乎可以,有其他更好的方法么?
- <script type="text/javascript">
- // offer 返回
- window.history.pushState('back.html', 'Back', 'back.html');
- // Landing page 返回
- window.history.pushState('index.php', 'index', 'index.php');
- </script>
- <script type="text/javascript">
- window.addEventListener("popstate", function(e) {
- if(document.URL.indexOf("back.html") >= 0){
- document.location.href = document.location;
- }
- });
- </script>
复制代码
谢谢!
|
评分
-
查看全部评分
|