使用ajax /Jquery Mobile-PhoneGap时,Iphone模拟器找不到页面

发布于 2024-12-27 03:55:47 字数 1861 浏览 0 评论 0原文

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

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

为了让它发挥作用,我已经做了一切。我已删除该文件并通过 add -> 将其恢复现有文件不走运。 “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>

任何建议将不胜感激..

I am creating a webapp for iPhone using jQuery Mobile and PhoneGap. Everything works fine in Safari for Mac and Chrome for Windows.

When I go to the iPhone Simulator the problems begin. Every button with a link to any page works fine except for one called "Article.html". The only way to open this page from the app is to turn off ajax by doing rel="external".

I have done everything in order to get it work. I have deleted the file and brought it back via add -> existing file with not luck. The content of the page "Article.html" is very simple and I don't think that is the problem because it doesn't even load the page. The loading symbol stays there for ever.

<!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>

ANY SUGGESTION WOULD BE APPRECIATED..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无远思近则忧 2025-01-03 03:55:47
    <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 的完整路径

    <a href="home1.html" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home" data-prefetch>Home</a>

please give the full path in href for home1.html

余厌 2025-01-03 03:55:47

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

由于某种原因,这一行出现了问题:

<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>

,问题就解决了。

很奇怪,但它有效。

感谢您的帮助。

I found the answer by testing line by line.

For some reason, this line was giving problems:

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

As you can see, href is blank. I just put a bogus url

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

and that solved the problem.

Weird but it works.

Thanks for your help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文