mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-28 01:44:45 +00:00
Add check to see if ajax should be disabled
This commit is contained in:
parent
aa8b0b7cfd
commit
92e198c04c
1 changed files with 14 additions and 3 deletions
|
|
@ -56,15 +56,26 @@ $(function(){
|
|||
|
||||
|
||||
// Turn off AJAX for local file browsing
|
||||
if ( location.protocol.substr(0,5) === 'file:' ) {
|
||||
if ( location.protocol.substr(0,4) === 'file' ||
|
||||
location.protocol.substr(0,11) === '*-extension' ||
|
||||
location.protocol.substr(0,6) === 'widget' ) {
|
||||
$( function() {
|
||||
$( "a" )
|
||||
.filter( "[href='../']" ).attr( "href", "../index.html" ).end()
|
||||
.filter( "[href='../../']" ).attr( "href", "../../index.html" ).end()
|
||||
.filter( "[href='../../../']" ).attr( "href", "../../../index.html" );
|
||||
});
|
||||
$( document ).bind( "mobileinit", function() {
|
||||
$.mobile.ajaxEnabled = false;
|
||||
|
||||
// Check to see if ajax can be used. This does a quick ajax request and blocks the page until its done
|
||||
$.ajax({
|
||||
url: '.',
|
||||
async: false,
|
||||
isLocal: true
|
||||
}).error(function() {
|
||||
// Ajax doesn't work so turn it off
|
||||
$( document ).bind( "mobileinit", function() {
|
||||
$.mobile.ajaxEnabled = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue