New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false positive in history management support detection #733

Closed
bitinn opened this Issue Oct 19, 2012 · 4 comments

Comments

Projects
None yet
4 participants
@bitinn

bitinn commented Oct 19, 2012

This issue has been known for a while but I haven't found a solid way to workaround it.

History API support used by modernizr and majority of routing frameworks does this:

!!(window.history && history.pushState)

This is fine on desktop browser, but for mobile browser, in particular android 2.2 - 4.0 and iOS 4, this leads to false positive, where they claim support for pushState, but has issue such as "location.pathname is not updated" or "address bar does not update"

reference:
http://code.google.com/p/android/issues/detail?id=17471
http://caniuse.com/#search=history

This is an issue because we cannot provide a fallback (e.g. hashchange) as it is not reliably detected.

one might say "forget it and let mobile device do a full refresh", but for Web App this is quite critical as full page rendering slow down workflow, even if we assume client-side caching is working.

Hope someone can comment on this.

@hay

This comment has been minimized.

Show comment
Hide comment
@hay

hay Nov 12, 2012

Contributor

Yup, this is a pretty nasty bug that's difficult to detect (i don't know how you should detect the buggy behavior).

The biggest problem for me is window.location not giving the correct address (it never updates). This means writing a good router is difficult. For now, i don't know any other way to fix this than browser sniffing.

Contributor

hay commented Nov 12, 2012

Yup, this is a pretty nasty bug that's difficult to detect (i don't know how you should detect the buggy behavior).

The biggest problem for me is window.location not giving the correct address (it never updates). This means writing a good router is difficult. For now, i don't know any other way to fix this than browser sniffing.

@paulirish

This comment has been minimized.

Show comment
Hide comment
@paulirish

paulirish Nov 12, 2012

Member

This is legit.

Let's add a UA sniff in here.

There isn't another clean way to work around it.

Member

paulirish commented Nov 12, 2012

This is legit.

Let's add a UA sniff in here.

There isn't another clean way to work around it.

@hay

This comment has been minimized.

Show comment
Hide comment
@hay

hay Nov 13, 2012

Contributor

I've written a patch using UA sniffing. See: #746

When that is pulled this comment can be closed.

Contributor

hay commented Nov 13, 2012

I've written a patch using UA sniffing. See: #746

When that is pulled this comment can be closed.

hay added a commit to hay/Modernizr that referenced this issue Nov 19, 2012

aFarkas added a commit that referenced this issue Nov 20, 2012

Merge pull request #746 from hay/master
'Fix' for #733: false positive in history management support detection

SlexAxton added a commit to SlexAxton/Modernizr that referenced this issue Dec 3, 2012

Merge branch 'master' of github.com:Modernizr/Modernizr
* 'master' of github.com:Modernizr/Modernizr:
  history check should check for Android 2
  made check a little clearer, removing a nested if statement
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
  use addEventListener instead of DOM level 1 events (fixes #697)
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Jan 23, 2013

Member

Fixed in #746

Member

sindresorhus commented Jan 23, 2013

Fixed in #746

SlexAxton pushed a commit to SlexAxton/Modernizr that referenced this issue Feb 14, 2013

Merge pull request #746 from hay/master
'Fix' for #733: false positive in history management support detection

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015

Merge pull request #746 from hay/master
'Fix' for #733: false positive in history management support detection

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015

Merge branch 'master' of github.com:Modernizr/Modernizr
* 'master' of github.com:Modernizr/Modernizr:
  history check should check for Android 2
  made check a little clearer, removing a nested if statement
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
  use addEventListener instead of DOM level 1 events (fixes #697)
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment