【问题标题】:Page is not found by the Iphone simulator when using ajax /Jquery Mobile-PhoneGap使用 ajax /Jquery Mobile-PhoneGap 时 Iphone 模拟器找不到页面
【发布时间】:2012-02-10 09:18:03
【问题描述】:

我正在使用 jQuery Mobile 和 PhoneGap 为 iPhone 创建一个 webapp。在 Mac 版 Safari 和 Windows 版 Chrome 中一切正常。

当我使用 iPhone 模拟器时,问题就开始了。除了一个名为“Article.html”的按钮外,每个带有任何页面链接的按钮都可以正常工作。从应用程序打开此页面的唯一方法是通过执行 rel="external" 关闭 ajax。

为了让它发挥作用,我已经做了一切。我已经删除了该文件并通过添加 - >现有文件将其恢复,但运气不佳。 “Article.html”页面的内容非常简单,我认为这不是问题,因为它甚至没有加载页面。加载符号永远存在。

<!DOCTYPE html> 
<html>
    <head>
        <!--jquery and css files are being loaded in another page-->
        <title>This Date in History</title> 
    </head>
<body>
    <div data-role="page" class="type-interior" id="Article" data-add-back-btn="true" data-dom-cache="false"> 
        <div data-role="header" data-theme="a" data-position="fixed">
            <h1></h1>
            <a href="home1.html" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home" data-prefetch>Home</a>
        </div><!-- /header -->
        <div data-role="content">
                <h4 id="title"></h4>
                <h5 id="date"></h5>
                <div style="text-align:center;">
                    <img id="img" style="max-height: 138px; max-width: 200px; overflow: hidden;" src=""/>
                </div>
                <p id="milestone_text"></p>

                <a href="" id="more" data-role="button" data-icon="forward" rel="external">More about this event</a>
                </div><!-- /content -->
        <div data-role="footer" class="footer-docs" data-theme="a">
            <center><h5> Archives</h5></center>
        </div><!-- /footer -->
    </div><!--Page ends here-->
</body>

任何建议都会受到赞赏..

【问题讨论】:

  • 您的代码未显示您链接到Article.html的位置
  • 代码是Article.html。我对此的参考是一个简单的链接 Article

标签: javascript iphone jquery-mobile cordova ios-simulator


【解决方案1】:
    <a href="home1.html" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home" data-prefetch>Home</a>

请在 href 中给出 home1.html 的完整路径

【讨论】:

  • 抱歉造成混淆,但此代码指的是 Article.html 本身。我通过在另一个页面中执行 Article 来调用此页面。顺便说一句,home.html 是 PHONEGAP 中的完整路径。它们都在 www 文件夹中。
【解决方案2】:

我通过逐行测试找到了答案。

由于某种原因,这条线出现了问题:

<a href="" id="more" data-role="button" data-icon="forward" rel="external">More about this event</a>

如您所见,href 为空白。我只是放了一个虚假的网址

 <a href="www.google.com" id="more" data-role="button" data-icon="forward" rel="external">More about this event</a>

这样就解决了问题。

很奇怪,但它有效。

感谢您的帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-05
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    相关资源
    最近更新 更多