Chris2656882
Posts: 0
Joined: Fri May 11, 2012 3:47 pm

Page Refresh & Linking in Custom Javascript

How do you refresh a page and navigate to another screen using custom JavaScript?

I used the following notations, and neither worked:

Code: Select all

     location.reload(true);    

     $.mobile.changePage( "start_page.html", { transition: "fade"} );
maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Page Refresh & Linking in Custom Javascript

This worked for me:
code
$.mobile.changePage( "page2.html", { transition: "fade"} );
/code

My page from which I'm navigating is called 'page1'.

Chris2656882
Posts: 0
Joined: Fri May 11, 2012 3:47 pm

Page Refresh & Linking in Custom Javascript

It should be noted to people that the page URLs are in the format "mob-(page name).html"

That is, the name of the page in the project has "mob-" prepended to it.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Page Refresh & Linking in Custom Javascript

Just the page name (without mob-) should work. mob- is added when viewing in desktop browser. We are getting rid of that as well, soon.

Chris2656882
Posts: 0
Joined: Fri May 11, 2012 3:47 pm

Page Refresh & Linking in Custom Javascript

Without adding "mob-" the page transitions do not work for me in Chrome!

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Page Refresh & Linking in Custom Javascript

I just tried code from the original reply and it worked.

Chris2656882
Posts: 0
Joined: Fri May 11, 2012 3:47 pm

Page Refresh & Linking in Custom Javascript

I had been using the JQuery page transitions and they were working just fine. For example:

$.mobile.changePage( "property_profile.html" );

But recently, this is no longer working. Though, if it pre-pended with "mob-"
$.mobile.changePage( "mob-property_profile.html" );

it will work. But you had said this is only for desktop viewing.

Did you change the page name structure recently?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Page Refresh & Linking in Custom Javascript

I tried $.mobile.changePage( "mobilescreen2.html" ) and it worked. In general, you want to use the Tiggzi Navigate To Page, as when you navigating, we determine what resources need to be loaded in the new page.

Chris2656882
Posts: 0
Joined: Fri May 11, 2012 3:47 pm

Page Refresh & Linking in Custom Javascript

I write most of the code in Javascript, so the Tiggzi Navigate To Page is not an option.

All the $.mobile.changePage links that I had written that previously worked no longer do for some odd reason.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Page Refresh & Linking in Custom Javascript

Check if there are any JavaScript errors in console...

Return to “Issues”