Created
May 21, 2019 01:59
-
-
Save cvan/8ef8df9056b674f715c427ec121ca3b1 to your computer and use it in GitHub Desktop.
Vimeo.com script: hijack SPA links to do synchronous page loads (instead of single-page-app URL routing)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('click', evt => { | |
if (evt.shiftKey || evt.altKey || evt.metaKey) { | |
return; | |
} | |
const linkEl = evt.target && evt.target.closest('a[href]'); | |
if (linkEl && linkEl.hostname.endsWith('vimeo.com')) { | |
evt.preventDefault(); | |
evt.stopPropagation(); | |
window.location.href = linkEl.href; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment