Code Monkey home page Code Monkey logo

Comments (7)

stuxt avatar stuxt commented on July 30, 2024

var _wr = function(type) { var orig = history[type]; return function() { var rv = orig.apply(this, arguments); var e = new Event(type); e.arguments = arguments; window.dispatchEvent(e); return rv; }; };
这种写法在pc和移动端有兼容问题吗?

from blog.

forthealllight avatar forthealllight commented on July 30, 2024

var _wr = function(type) { var orig = history[type]; return function() { var rv = orig.apply(this, arguments); var e = new Event(type); e.arguments = arguments; window.dispatchEvent(e); return rv; }; };
这种写法在pc和移动端有兼容问题吗?

基本没有兼容性问题,因为也没用到啥高级的api,我刚刚查了一下window.dispatchEvent 这个api,除了IE6-8 其他兼容性都没有问题。

from blog.

stuxt avatar stuxt commented on July 30, 2024

测试了一下popstate和hashchange这两个会同时触发,无论是window.location.hash= ‘124’还是History.back(),History.forward()、History.go()都会同时触发这两个事件的。

from blog.

forthealllight avatar forthealllight commented on July 30, 2024

测试了一下popstate和hashchange这两个会同时触发,无论是window.location.hash= ‘124’还是History.back(),History.forward()、History.go()都会同时触发这两个事件的。

你说在你的移动端吗。

from blog.

Vibing avatar Vibing commented on July 30, 2024

测试了一下popstate和hashchange这两个会同时触发,无论是window.location.hash= ‘124’还是History.back(),History.forward()、History.go()都会同时触发这两个事件的。

你说在你的移动端吗。

popstate在webkit内核浏览器中就是这样的,可以说是webkit的BUG。

传送门:https://stackoverflow.com/questions/6421769/popstate-on-pages-load-in-chrome

from blog.

forthealllight avatar forthealllight commented on July 30, 2024

测试了一下popstate和hashchange这两个会同时触发,无论是window.location.hash= ‘124’还是History.back(),History.forward()、History.go()都会同时触发这两个事件的。

你说在你的移动端吗。

popstate在webkit内核浏览器中就是这样的,可以说是webkit的BUG。

传送门:https://stackoverflow.com/questions/6421769/popstate-on-pages-load-in-chrome

thx

from blog.

js1k avatar js1k commented on July 30, 2024

写了个js sdk, 在实际vue 项目中引入之后,pushState, replaceState总是同时触发,需要做啥特殊处理么?

from blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.