Pjax is not working properly on mobile chrome. #182

Closed
opened 2018-11-01 21:21:08 -05:00 by venzersiz · 6 comments
venzersiz commented 2018-11-01 21:21:08 -05:00 (Migrated from github.com)

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

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
BehindTheMath commented 2018-11-11 16:15:40 -05:00 (Migrated from github.com)

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

Can you give some more details about what's not working?
venzersiz commented 2018-11-13 02:29:39 -05:00 (Migrated from github.com)

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.

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.
BehindTheMath commented 2018-11-13 08:50:34 -05:00 (Migrated from github.com)

What about in mobile Safari?

What about in mobile Safari?
venzersiz commented 2018-11-13 20:11:32 -05:00 (Migrated from github.com)

In mobile Safari, it works normally.

In mobile Safari, it works normally.
BehindTheMath commented 2018-11-26 21:18:06 -05:00 (Migrated from github.com)

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.

This appears to be a reported issue with Chrome on iOS (see [here](https://bugs.chromium.org/p/chromium/issues/detail?id=308674#c12), [here](https://stackoverflow.com/questions/46466618/why-popstate-doesnt-fire-my-function-when-back-button-is-clicked-mobile-ios-ch), and [here](https://productforums.google.com/forum/#!topic/chrome/n8_eZN7wFvM)). 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](https://developer.mozilla.org/en-US/docs/Web/Events/popstate) says that `popstate` has limited support in iOS Safari, so it's possible that this is one of the issues.
venzersiz commented 2018-11-27 19:25:31 -05:00 (Migrated from github.com)

OK. Thank you for a long time.

OK. Thank you for a long time.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#182