Skip to content
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

supportsHistory is broken in Brave Browser #723

Closed
paramsinghvc opened this issue Jul 25, 2019 · 4 comments · Fixed by #751
Closed

supportsHistory is broken in Brave Browser #723

paramsinghvc opened this issue Jul 25, 2019 · 4 comments · Fixed by #751

Comments

@paramsinghvc
Copy link

paramsinghvc commented Jul 25, 2019

I'm using Brave Browser and hence this userAgent condition is failing

function supportsHistory() {
  var ua = window.navigator.userAgent;
  if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
  return window.history && 'pushState' in window.history;
}

My UA looks like this

Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

But it does support latest history apis.

Here's the original issue remix-run/react-router#6844

@mjackson
Copy link
Member

mjackson commented Aug 6, 2019

Ah, how thoughtful of Brave to include Mobile Safari in its UA string...

I'm honestly not sure the best way to fix this. Open to suggestions.

In the next major version we won't have this problem because we will only support browsers that support the pushState API. But it's definitely something to fix in version 4.

@mjackson mjackson changed the title Breaking supportsHistory function on Brave Browser supportsHistory is broken in Brave Browser Aug 6, 2019
@mjackson
Copy link
Member

mjackson commented Aug 6, 2019

Aside: we should probably also add Brave to our test matrix if BrowserStack supports it.

@damianon
Copy link

why not use feature detection instead of user agent string?

mjackson added a commit that referenced this issue Nov 5, 2019
New features:
- Remove legacy browser support (pre pushState)
- Add state to hash history
- Use custom window when creating history objects
- Better history.block API (wip)
- Fix location.pathname encoding issues
- About 50% smaller
- No dependencies

Removed features:
- Removes basename support
- Removes getUserConfirmation
- Removes keyLength
- Removes hashType
- Removes relative pathname support in hash + memory histories

Still TBD:
- Missing pathname support in push/replace

Fixes #624
Fixes #704
Fixes #723
Fixes #726
@mjackson mjackson mentioned this issue Nov 5, 2019
Merged
@mjackson
Copy link
Member

mjackson commented Nov 8, 2019

Heads up: we are no longer doing this check in the v5 beta released this morning. Please give it a shot and LMK how it goes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants