jQuery Mobile的HR​​EF链接不加载新的一页 [英] Jquery mobile href link dont load new page

查看:104
本文介绍了jQuery Mobile的HR​​EF链接不加载新的一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从意大利网络devoper ......我有负荷与HREF的问题 例: 我已经one.html与此code

i'm a web devoper from Italy...I have a problem with loading with href example: i have one.html with this code

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <title>dkrMobile</title>
    <!--caricamento librerie-->
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="js/jquery.mobile-1.3.1.min.js"></script>
    <link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css">
</head>
<body>
<!-- LOGIN -->
<div data-role="page" id="loginPage">
    <div data-role="content">
        <div style=" text-align:center">
            <img style="width: 70%;" src="http://www.laboncloud.it/dkrmobile/css/images/logdkr.png">
        </div>
        <form action="#pageFile">
            <div data-role="fieldcontain">
                <label for="userNameLogin">
                    Username
                </label>
                <input name="" id="userNameLogin" placeholder="" value="" type="text">
            </div>
            <div data-role="fieldcontain">
                <label for="passwordLogin">
                    Password
                </label>
                <input name="" id="passwordLogin" placeholder="" value="" type="password">
            </div>

            <a data-role="button" data-theme="a" data-transition="fade" href="two.html" data-prefetch="trues">
                Login
            </a>

        </form>
    </div>
</div>
</body>
</html>

和本code中的two.html:

and the two.html with this code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <title>dkrMobile</title>
    <!--caricamento librerie-->
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="js/jquery.mobile-1.3.1.min.js"></script>
    <link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css">
    <link rel="stylesheet" href="css/jqm-icon-pack-fa.css">
    <script type="text/javascript" src="js/tolito-1.0.5.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/tolito-1.0.5.min.css" />

    <!--css userinterface-->
    <link rel="stylesheet" href="css/ui.css" />




</head>
<body>

<div data-role="page" id="loadingPage">
    <div data-role="content">
    <h1>caricamento di tutti i contenuti in corso</h1>
    <a data-role="button" data-theme="a" data-transition="fade" href="#pageFile">skip</a>
    </div>
</div>

<div data-role="page" id="pageFile">
    <div data-role="content">
    <h1>dueeee</h1>

    </div>
</div>

<!-- FILE-->

</body>
</html>

现在,如果自来水的登录 - 在two.html不会被加载

now if tap on login - the two.html will no be loaded.

希望有一个演示? 这里演示

如果我点击跳过two.html不显示任何内容(如果我刷新页面,它开始工作)。

if I click on skip in two.html dont show nothing (if I refresh the page it start work).

唯一的办法就是数据的ajax =假?为什么呢?

the only way is data-ajax="false" ? why?

推荐答案

这是不是一个错误。要搞清楚这个问题,你必须了解jQuery Mobile的是如何工作的。

This is not an error. To understand this problem you must understand how jQuery Mobile works.

多的 HTML 模板不能多页面模板混合。例如,当有几个 HTML 页的工作,只有第一个可以有一个以上的页面。当jQuery Mobile的加载其他 HTML 文件将带钢头部(我们不需要它,因为第一个 HTML HEAD内容已经被加载到DOM),它会只加载第一页就可以在一个文件中发现,所有其他网页将被丢弃。

Multi HTML template can't be mixed with multi page template. For example when working with several HTML pages, only first one can have more then one page. When jQuery Mobile loads other HTML files it will strip HEAD (we dont need it because first HTML HEAD content is already loaded into the DOM) and it will load ONLY first page it can find in a file, every other page will be discarded.

数据 - prefetch 不会帮助你在这里。你也正在初始化它不正确,数据 - prefetch属性不具有价值,它只是 数据 - prefetch ,例如:

data-prefetch will not help you here. Also you are initializing it incorrectly, data-prefetch attribute don't have a value, it is just data-prefetch, example:

<a data-role="button" data-theme="a" data-transition="fade" href="two.html" data-prefetch>Login</a>

如果您想了解更多的jQuery Mobile的如何处理多个HTML和多页模板或它们是什么来看看这的文章 之一。是透明的,他们是我的个人博客文章。你需要知道的一切都可以在那里找到。

If you want to find out more how jQuery Mobile handles multiple HTML and multiple page templates or what are they take a look at this ARTICLE or THIS one. To be transparent they are my personal blog articles. Everything you need to know can be found there.

基本上解决您的问题将有里面的一个 HTML 文件中的所有页面,或者你应该刹车two.html成两个独立的 HTML 文件。你决定什么对你是一个最好的解决方案。

Basically solution to your problem would be to have all pages inside a single HTML file, or you should brake two.html into two separate HTML files. you decide what is a best solution for you.

这篇关于jQuery Mobile的HR​​EF链接不加载新的一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆