mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-26 14:53:59 +00:00
This change moves the ajax navigation opt-out list (which contains, mainly, browsers that have broken history tracking of hash changes) over to the support.js file, and added a multi-tierd Nokia condition that checks a number of UA conditions to try and pinpoint Nokia + Symbian + Webkit + 7.3-or-older. Big thanks to Bryan and Stephanie at Yiibu for their helpful article on Nokia device detection. That said, we would LOVE to find a non-UA based way to handle this detection. Reluctantly, this seems to do what we need at the moment, while assuming hash history will be improved in any post-7.3 release.
Also included in this commit is a Nokia-specific condition that re-appends existing stylesheets to force them to render, as all pre-7.3 devices we tested would not render the CSS if it was referenced before the JavaScript (as we'd recommend doing). There may be a non-JS way to work around this problem, but for now, this seems to do the trick.
This commit is contained in:
parent
b77bf47d1d
commit
d42db4d4ee
2 changed files with 37 additions and 2 deletions
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
// override ajaxEnabled on platforms that have known conflicts with hash history updates
|
||||
// or generally work better browsing in regular http for full page refreshes (BB5, Opera Mini)
|
||||
if( window.blackberry && !window.WebKitPoint || window.operamini && Object.prototype.toString.call( window.operamini ) === "[object OperaMini]" ){
|
||||
if( $.mobile.ajaxBlacklist ){
|
||||
$.mobile.ajaxEnabled = false;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
//note that this initial scroll won't hide the address bar. It's just for the check.
|
||||
$(function(){
|
||||
window.scrollTo( 0, 1 );
|
||||
|
||||
|
||||
//if defaultHomeScroll hasn't been set yet, see if scrollTop is 1
|
||||
//it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar)
|
||||
//so if it's 1, use 0 from now on
|
||||
|
|
|
|||
|
|
@ -79,6 +79,41 @@ $.extend( $.support, {
|
|||
|
||||
fakeBody.remove();
|
||||
|
||||
|
||||
// $.mobile.ajaxBlacklist is used to override ajaxEnabled on platforms that have known conflicts with hash history updates (BB5, Symbian)
|
||||
// or that generally work better browsing in regular http for full page refreshes (Opera Mini)
|
||||
// Note: This detection below is used as a last resort.
|
||||
// We recommend only using these detection methods when all other more reliable/forward-looking approaches are not possible
|
||||
var nokiaLTE7_3 = function(){
|
||||
|
||||
var ua = window.navigator.userAgent;
|
||||
|
||||
//The following is an attempt to match Nokia browsers that are running Symbian/s60, with webkit, version 7.3 or older
|
||||
return ua.indexOf( "Nokia" ) > -1
|
||||
&& ( ua.indexOf( "Symbian/3" ) > -1 || ua.indexOf( "Series60/5" ) > -1 )
|
||||
&& ua.indexOf( "AppleWebKit" ) > -1
|
||||
&& ua.match( /(BrowserNG|NokiaBrowser)\/7\.[0-3]/ );
|
||||
}();
|
||||
|
||||
$.mobile.ajaxBlacklist =
|
||||
// BlackBerry browsers, pre-webkit
|
||||
window.blackberry && !window.WebKitPoint
|
||||
// Opera Mini
|
||||
|| window.operamini && Object.prototype.toString.call( window.operamini ) === "[object OperaMini]"
|
||||
// Symbian webkits pre 7.3
|
||||
|| nokiaLTE7_3;
|
||||
|
||||
// Lastly, this workaround is the only way we've found so far to get pre 7.3 Symbian webkit devices
|
||||
// to render the stylesheets when they're referenced before this script, as we'd recommend doing.
|
||||
// This simply reappends the CSS in place, which for some reason makes it apply
|
||||
if( nokiaLTE7_3 ){
|
||||
$(function(){
|
||||
$( "head link[rel=stylesheet]" ).each(function(){
|
||||
$( this ).attr( "rel", "alternate stylesheet" ).attr( "rel", "stylesheet" );
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// For ruling out shadows via css
|
||||
if ( !$.support.boxShadow ){
|
||||
$( "html" ).addClass( "ui-mobile-nosupport-boxshadow" );
|
||||
|
|
|
|||
Loading…
Reference in a new issue