Comments (12)
I've been using the excellent HTML5 History API Polyfill for a few projects. The only change I've had to do in other routing libraries is reference the location object before using it:
var location = window.history.location || window.location;
from react-router.
Using hash locations should be fine. If not, there is a bug. Can you verify if these demos are broken?
http://rpflorence.github.io/react-nested-router/examples/query-params
from react-router.
That example throws an error that the method isArray
is not supported. So, the examples aren't using the es5-shim.js polyfill that is needed to support old browsers.
I have been using hash locations anyways. The problem comes that I have to explicitly hit refresh to get the page to load after calling transitionTo
.
from react-router.
For the record, we absolutely want to support what react supports, we just haven't done all of the work yet!
from react-router.
@bitsoglass I'm confused. Why does IE8 need the refresh?
from react-router.
It doesn't support pushState.
See #50
tl;dr - instead of falling back to hashes when using location="history"
, you fall back to full page reloads so that users on new and legacy browsers can share identical urls.
from react-router.
I'm already using hashes and am currently looking into why a refresh might have been needed.
From what I have found so far window.addEventListener
is not supported in IE 8 and window.attachEvent
is needed instead. Also, hashchange
is not a valid listener for IE 8 it needs to be onhashchange
which was causing notifyChange not to fire. I'm about to run some tests and see if that fixes my refresh issue, which I am fairly confident it will.
from react-router.
Two things are going on here:
- We don't fall back to anything when using
location="history"
- We are using code like
Array.isArray
andaddEventListener
that IE8 doesn't support.
@bitsoglass I would only try to solve (2) here, we are discussing a solution to (1) in #50.
from react-router.
Array.isArray
is already solved by using es5-shim.js
as documented by React here.
Which users interested in supporting IE 8 should already be including for the purposes of using React in the first place.
Also, I have figured out how to test for addEventListener
and fix it in IE8. This did fix the reload issue as well so there is no need any longer to do so.
I will submit a pull request with the check and fix for addEventListener
in IE 8.
from react-router.
awesome, thanks :)
from react-router.
Maybe I'm confused as to the status of this ... but I seem to running into exactly the issue raised above, with v0.11.4: The routing works on IE8 only if I manually refresh. Just clicking a link changes the hash in the URL but doesn't have an effect on the rendered page.
I have es5-shim running and in the IE8 dev tools I'm not seeing any console errors when I click a link --- it's just that nothing happens.
Am I missing something about what's needed to implement this with IE8?
from react-router.
Update --- don't know what changed (I'm in early stages of an app so doing a bunch of rewriting), but now it is working! That's good. Must have been something funny going on in my code (might have been that I had a history API polyfill in place because I was also trying out page.js, which required the polyfill (and still didn't work)).
from react-router.
Related Issues (20)
- [Bug]: `setSearchParams` do not provide the latest queryString passed as argument to `navigate` HOT 3
- [Bug]: React Router swallows render error HOT 1
- [Bug]: useBlocker in createBrowserRouter is not working
- [Bug]: useLocation value being null when 0 is set as the state value of useNavigate
- [Docs]: for useSearchParams, functional updates should be explained in more detail HOT 3
- [Bug]: React router doesn't handle 'content://' URLs
- [Bug]: the state is not destroyed in the useFetcher hook with key parametr
- [Bug]: Outlet component remounts in production when changing state above it HOT 2
- [Bug]: loader of Route running even if Route / Router is not rendered HOT 2
- [Docs]: Docs for shouldRevalidate make it sound like it is only for opting out
- [Bug]: `useLocation` out of sync with `history.location`, leads to potential renders of unmatched `Route`s
- [Bug]: useLoaderData triggers component re rendering even if the route remains unchanged HOT 1
- [Bug]: Cloudflare Pages - Outlet not working. HOT 32
- [Bug]: No route matches URL in production build HOT 3
- [Bug]: <Outlet/> Component is not working in deployment HOT 1
- [Bug]: `window.location` is not updated after a call to `router.navigate()` HOT 1
- [Bug]: router doesn't work in production build, only shows blank. HOT 1
- [Bug]: `<Navigate>` can be canceled by `navigate("?x")` even if guarded by `if(navigation.state === "idle")` HOT 1
- [Bug]: Using embed in a route with param causes it to render the whole application inside the div. HOT 1
- [Docs]: V6 - Mixing up <Route /> with lists [<Route />, <Route />] within one <Routes /> looks working but isn't mentioned in the docs and covered in unit tests. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-router.