使用ajax /Jquery Mobile-PhoneGap时,Iphone模拟器找不到页面
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请在 href 中给出 home1.html 的完整路径
please give the full path in href for home1.html
我通过逐行测试找到了答案。
由于某种原因,这一行出现了问题:
如您所见,href 为空。我只是输入了一个虚假的网址
,问题就解决了。
很奇怪,但它有效。
感谢您的帮助。
I found the answer by testing line by line.
For some reason, this line was giving problems:
As you can see, href is blank. I just put a bogus url
and that solved the problem.
Weird but it works.
Thanks for your help.