[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

jQuery mobile 1.4.2: how to disable $.mobile.pushStateEnabled in jquery mobile 1.4.2

Hello Experts,

how do I disable $.mobile.pushStateEnabled in jquery mobile 1.4.2?

Regards,
0
epifanio67
Asked:
epifanio67
  • 3
  • 2
2 Solutions
 
GaryCommented:
Add immediately after the jQuery Mobile script i.e. before any other code is implemented

$.mobile.pushStateEnabled = false
0
 
Sammy AgeilCommented:
I am going to have to disagree with Gary on this, the proper way to disable pushstate is to set it to false within the the global configuration (in the document mobileinit event)

$(document).bind("mobileinit", function(){
  $.mobile.pushStateEnabled = false;
});
see the documentation here http://api.jquerymobile.com/global-config/
Note that the event is called before jquery mobile is loaded.

Good luck
0
 
GaryCommented:
You can always disagree with me when I am wrong.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
epifanio67Author Commented:
Thank you Sammy, Gary for your help....

I read the docs; but find it confusing (different versions)...

is this the correct way to do it?
<link rel="stylesheet" href="./views/head/css/custom.css" />
<link rel="stylesheet" href="./views/head/css/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile.structure-1.4.2.min.css" />
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
$(document).bind("mobileinit", function(){
  $.mobile.pushStateEnabled = false;
});
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>

Open in new window


Regards,
0
 
Sammy AgeilCommented:
Yes,
Because jQM depends on jQuery, jQuery has to load first then jQM

Sammy
0
 
Sammy AgeilCommented:
I believe both of OP's questions were answered correctly with an example.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now