脱离jQtouch?
我试图让我的移动用户可以选择通过加载不同的页面来查看完整的网站。
事实是,jQtouch 深思熟虑地将链接转换为 ajax 调用,因此用户根本不会离开页面。
有没有办法打破jQt或排除某些链接加载ajax方式?
I'm trying to give my mobile users the choice to view the full website by loading a different page.
Thing is, jQtouch thoughtfully transforms links into ajax calls, so the user doesn't leave the page at all.
Is there some way to break out of jQt or exclude certain links from loading ajaxically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题。
检查源代码表明您可以显式添加一个属性来阻止库尝试“ajaxify”链接:
支持在新窗口中打开链接
target="_blank"
rel="同一窗口支持“external”
。I had the same question.
Inspecting the source code reveals that you can explicitly add an attribute to stop the library trying to "ajaxify" a link:
target="_blank"
is supported for opening links in new windowsrel="external"
is supported for the same window.只需将
target="_blank"
添加到您的外部链接即可。http://code.google.com/p/jqtouch/issues/详情?id=9
Just add
target="_blank"
to your external links and it should work.http://code.google.com/p/jqtouch/issues/detail?id=9
如果您希望 jQTouch 忽略外部链接,那么只需为同一窗口链接添加
rel="external"
或为新窗口链接添加target="_blank"
即可。然而,一个常见的问题是 jQTouch 拦截所有 AJAX 命令(表单、POST 命令等)并自行安全地提交它们。这不是问题,除非它期待某种回调,但实际上并没有回调。在最近的一个项目中,我想提交一个没有回调的表单。为此,请查看jqtouch.js
库(第 434 行左右)并注释掉以下行:这基本上只是告诉 jQTouch 提交 AJAX 调用,但之后不执行任何操作。它不会更改 div,不会显示任何回调,也不会调用任何动画。希望这对某人有帮助。
If you want jQTouch to ignore the external link, then yes just add
rel="external"
for same-window links ortarget="_blank"
for new-window links. However, a common problem is that jQTouch intercepts all AJAX commands (forms, POST commands, etc) and safely submits them itself. This isn't a problem except for when it's expecting some sort of callback, and there isn't one. In a recent project, I wanted to submit a form without a callback. To do this, look in thejqtouch.js
library (around line 434) and comment out the following line:This basically just tells jQTouch to submit the AJAX call but do nothing afterwards. It won't change div's, it won't show any callbacks and it won't call any animations. Hope this helps someone.