Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

# character in url of jquery mobile page

Why is it that when I visit my jQuery mobile page, lets say page.php it shows up fine, but when I visit the same page page.php#someDetailsHere it just shows a white page? And how can I fix this?

I use a third party app that redirects to my webpage with the # added to the url..

like image 478
askemottelson Avatar asked Jan 26 '26 16:01

askemottelson


1 Answers

Edit: I stepped through your page to see what was going on.

Your grief is caused by jQuery Mobile. When the page loads, it detects this as an "page change", and because jQuery Mobile uses the hash (#) to emulate the back-button for AJAX requests, it also has some special handling for pages that it sees are loaded with a hash.

The bottom line is that it sees a page load, decides it should "reject" it, and prevents anything further from happening.

My guess is that the jQuery Mobile team didn't expect anyone to load a mobile page with a hash on init, since the code seems to assume that the first load of the page will not have one.

To follow this yourself, set a breakpoint in the function isEmbeddedPage in jquery.mobile-1.0.min.css.

A possible solution would be to somehow prevent the jQuery Mobile code from running when the page initially loads. This might break other stuff that jQuery Mobile provides, though.

like image 50
Shalom Craimer Avatar answered Jan 29 '26 06:01

Shalom Craimer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!