我正在使用jQuery 1.6.4与jQuery Mobile 1.0.1.当我们链接到一个页面然后尝试做一个301重定向时,我遇到一个问题.
我已经设置了一个示例页面:http://www.widgetsandburritos.com/jquery-mobile-test/
这个页面上唯一的一件事就是jQuery Mobile包含了一个链接到另一个页面,其中有一个301重定向在别的地方.
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
- <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
- </head>
- <body>
- <a href="301test.PHP">301 test</a>
- </body>
- </html>
这只是简单地将浏览器传递给301success.html.如果您直接访问该网址,它将起作用
http://www.widgetsandburritos.com/jquery-mobile-test/301test.php
但是当您使用jQuery Mobile单击页面上的链接时,它会显示“undefined”. jQuery Mobile目前无法处理重定向吗?
任何可能的工作?
谢谢你的帮助.
编辑[3/23/12 12:41 AM CST]
有人建议在锚标签中添加rel =“external”.在技术上,如果您正在做的是创建链接,但如果您通过其他机制(如POST请求)进行重定向,则无法解决问题.
为了说明,我已经在http://www.widgetsandburritos.com/jquery-mobile-test/test2.html设置了二次测试
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
- <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
- </head>
- <body>
- <form method="post" action="301test.PHP">
- <input type="submit" value="test" />
- </form>
- </body>
- </html>
而不是从链接到达301test.PHP重定向页面,现在是我们提交的表单的位置.将使用的上下文将是这样的,如果您提交一个错误的表单,它将保留在同一页面上,允许您更正错误.如果没有错误,它将重定向到成功页面.这样做是为了避免在用户刷新浏览器时再次提交表单.它在正常的Web应用程序中非常出色.但是在与jQuery Mobile的组合中似乎不起作用.
只是以为我会给这个问题后的其他任何人提供一些额外的上下文.