Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Bad URLs with hashes are not gracefully handled #4119
I'm not sure if this is by design or not, but
Is a decent example of this.
I'd expect the page to just load at this point, instead it freezes with a JS error. This is likely caused by the way that hash changes are handled.
Double hash, or any form of bad URL, is not necessary — any (legitimate) hash will break init, eg:
From my execution, no errors are thrown, and no custom events are fired — the page rests in a loading state and initialisation is frozen.
EDIT: You can prevent this behaviour by executing
I'm also running across this when trying to load deeplinks using my multiview plugin, because by default my some.html#nested_page_ID will also be a bad URL. I have patched my JQM like this to fix it for me:
I'm trying to get by without touching JQM.js, so in case you are adding some more logic and are open for wishes... I would also like a custom event such as "loadFirstPage" to tap into.
I guess once you start thinking about supporting anchor tags, you will need some more logic here anyway, because all anchor tags will be bad as of now. What do you think?
Thinking more about a loadFirstPage event.... this would also be very useful for deeplinks to artifical hashtags. Say I have a page some.html, in which I'm updating content via Ajax.
I would like to reflect the updated page by changing the hashtag, but I can't because all deeplinks to this page ala some.html#new_content will break, because the page isn't there and I'm missing an event to tap into the first page being loaded to redirect to the actual page and fire an Ajax call to update the content.
No problem on the 2nd page with pagebeforechange, but on the first page, this does not fire, does it?
If I could do: