-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tony Laidig
authored and
Tony Laidig
committed
Sep 17, 2015
1 parent
881670d
commit b8b5a62
Showing
4 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
www/lib/angular-ios9-patch/angular-ios9-uiwebview.patch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Created by tonylaidig on 9/17/15. | ||
*/ | ||
angular.module('ngIOS9UIWebViewPatch', ['ng']).config(function($provide) { | ||
$provide.decorator('$browser', ['$delegate', '$window', function($delegate, $window) { | ||
if (isIOS9UIWebView($window.navigator.userAgent)) { | ||
return applyIOS9Shim($delegate); | ||
} | ||
return $delegate; | ||
function isIOS9UIWebView(userAgent) { | ||
return /(iPhone|iPad|iPod).* OS 9_\d/.test(userAgent) && !/Version\/9\./.test(userAgent); | ||
} | ||
function applyIOS9Shim(browser) { | ||
var pendingLocationUrl = null; | ||
var originalUrlFn= browser.url; | ||
browser.url = function() { | ||
if (arguments.length) { | ||
pendingLocationUrl = arguments[0]; | ||
return originalUrlFn.apply(browser, arguments); | ||
} | ||
return pendingLocationUrl || originalUrlFn.apply(browser, arguments); | ||
}; | ||
window.addEventListener('popstate', clearPendingLocationUrl, false); | ||
window.addEventListener('hashchange', clearPendingLocationUrl, false); | ||
function clearPendingLocationUrl() { | ||
pendingLocationUrl = null; | ||
} | ||
return browser; | ||
} | ||
}]); | ||
}); |