Dogstudio / highway

Highway - A Modern Javascript Transitions Manager
https://highway.js.org/
MIT License
1.43k stars 92 forks source link

H.redirect always refresh page #118

Open Rinmawia opened 1 year ago

Rinmawia commented 1 year ago

I have a code that use gsap scroll trigger to call the H.redirect() when scroll to that element. But instead of transitioning the page, it hard redirect to the destination page.

... ScrollTrigger.create({ ... onEnter: () => { H.redirect('dest', 'myTransitionKey') } ... })

stefbowerman commented 1 year ago

I ran into the same problem - it's related to this line where it compares location.origin of the passed in url vs the url of the current page.

It can be fixed by explicitly passing the origin like:

... ScrollTrigger.create({ ... onEnter: () => { H.redirect(`${window.location.origin}/dest`, 'myTransitionKey') } ... })