简体   繁体   中英

Jquery multipage html

I came across the problem of trying to link several multipage html files with jquery mobile and found out the hard way that when using ajax, jquery mobile will not show the full document, rather the first page.

I looked up the problem and found todd thomsons subpage widget but was unable to get the plugin to work. So now I'm trying to find out, with out using ajax, is it possible to load an external multipage html file, but not leave the ios web app window and launch safari?

I saw this bit of javascript in my searches but I'm not sure how it would work out.

<a href="file2.html" data-icon="back" data-ajax="false" class="file2">Log Out</a></li>

$(document).bind('pageinit', function() {
  $('.file2').click(function (event) {
    event.preventDefault();
    window.location.assign("file.html");
  });
});

So i guess my question is, with javascript, is it possible to load an external html file with out leaving the web app view?

If I understand your question correctly (you need to change page to file.html which is a multipage jQM document) you can try

<li><a href="file1.html" rel="external" data-icon="back">Log Out</a></li>

or if you need to change page programmatically

<li><a id="logout" href="#" data-icon="back">Log Out</a></li>

and

$(document).on('pageinit', '#logout', function() {
  $('#logout').click(function (event) {
    event.preventDefault();
    $.mobile.ajaxEnabled = false;
    $.mobile.changePage("file1.html");
  });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM