#jquery移动页面的url中的字符 [英] # character in url of jquery mobile page
问题描述
为什么当我访问我的jQuery移动页面时,让我们说page.php它显示得很好,但是当我访问同一页面时页面.php#someDetailsHere它只显示一个白页?
我该如何解决这个问题?
Why is it that when I visit my jQuery mobile page, lets say page.php it shows up fine, but when I visit the same page page.php#someDetailsHere it just shows a white page? And how can I fix this?
我使用第三方应用程序,使用#$ c重定向到我的网页$ c>添加到网址..
I use a third party app that redirects to my webpage with the #
added to the url..
推荐答案
编辑:我走过你的页面看看发生了什么。
I stepped through your page to see what was going on.
你的悲痛是由jQuery Mobile引起的。当页面加载时,它会将其检测为页面更改,并且因为jQuery Mobile使用哈希(#
)来模拟AJAX请求的后退按钮,所以对于它看到的加载了哈希的页面有一些特殊处理。
Your grief is caused by jQuery Mobile. When the page loads, it detects this as an "page change", and because jQuery Mobile uses the hash (#
) to emulate the back-button for AJAX requests, it also has some special handling for pages that it sees are loaded with a hash.
底线是它看到页面加载,决定它应该拒绝它,以及防止任何进一步发生。
The bottom line is that it sees a page load, decides it should "reject" it, and prevents anything further from happening.
我的猜测是jQuery Mobile团队没想到任何人都会在init上加载带有哈希的移动页面,因为代码似乎假设页面的第一个加载不会有一个。
My guess is that the jQuery Mobile team didn't expect anyone to load a mobile page with a hash on init, since the code seems to assume that the first load of the page will not have one.
要自己动手,在函数中设置一个断点isEmbeddedPage
in jquery.mobile-1.0.min.css
。
To follow this yourself, set a breakpoint in the function isEmbeddedPage
in jquery.mobile-1.0.min.css
.
一种可能的解决方案是以某种方式防止页面最初加载时运行的jQuery Mobile代码。这可能会打破jQuery Mobile提供的其他东西。
A possible solution would be to somehow prevent the jQuery Mobile code from running when the page initially loads. This might break other stuff that jQuery Mobile provides, though.
这篇关于#jquery移动页面的url中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!