I’m hosting few static web pages on GitHub (gh-pages). If the user tries to access a page which isn’t available, he/she is moved to a custom 404.html.
What I’m wondering is if is it possible to access the original requested URL from the custom 404.html, using just JavaScript? There’s no PHP nor any other server side technology available.
I’ve looked at the JavaScript’s Location-object but that seems to give only the access to the current URL (in this case the 404.html) but not to the original requested URL. What I’m trying to achieve is a 404.html which gives suggestion like “Did you mean to access url …” to the user but in order to do so, I need the access to the original URL.
your only hope would be
document.referrerbut of course GH would need to set it, which is highly unlikely for any page returning a HTTP 404 out of a request …