MoOx/pjax

Pjax is not working properly on mobile chrome.

venzersiz opened this issue · 6 comments

Hello! I found a problem.

On mobile chrome, when I touched browser's history navigation buttons (back, forward), pjax is not working properly. It works full reload.


pjax version: 0.2.5, 0.2.7
device: iPhone 7 / 8
iOS version: 12.0 (16A366)
mobile chrome version: 70.0.3538.75

Can you give some more details about what's not working?

In this codes,

        on(window, "popstate", function(st) {
            if (st.state) {
                var opt = clone(this.options)
                opt.url = st.state.url
                opt.title = st.state.title
                // Since state already exists, prevent it from being pushed again
                opt.history = false
                opt.scrollPos = st.state.scrollPos
                if (st.state.uid < this.lastUid) {
                    opt.backward = true
                }
                else {
                    opt.forward = true
                }
                this.lastUid = st.state.uid

                // @todo implement history cache here, based on uid
                this.loadUrl(st.state.url, opt)
            }
        }.bind(this))

On pc chrome, event handler is called. On mobile chrome, event handler is not called.

What about in mobile Safari?

In mobile Safari, it works normally.

This appears to be a reported issue with Chrome on iOS (see here, here, and here). I don't think there's anything we can do.

Although I haven't seen reports of it being an issue in iOS Safari, I personally had the same issue in Safari as well. MDN says that popstate has limited support in iOS Safari, so it's possible that this is one of the issues.

OK. Thank you for a long time.