Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a
* dependency on the "ngIOS9UIWebViewPatch" module to your main app module.
*
* For example:
*
* ```
* angular.module('myApp', ['ngRoute'])`
* ```
*
* becomes
*
* ```
* angular.module('myApp', ['ngRoute', 'ngIOS9UIWebViewPatch'])
* ```
*
*
* More info:
* - https://openradar.appspot.com/22186109
* - https://github.com/angular/angular.js/issues/12241
* - https://github.com/driftyco/ionic/issues/4082
*
*
* @license AngularJS
* (c) 2010-2015 Google, Inc. http://angularjs.org
* License: MIT
*/
angular.module('ngIOS9UIWebViewPatch', ['ng']).config(['$provide', function($provide) {
'use strict';
$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;
}
}]);
}]);
@IgorMinar

This comment has been minimized.

Show comment
Hide comment
@IgorMinar

IgorMinar Sep 11, 2015

I've updated the gist to v1.0.3 which should do better job of useragent sniffing and support iPad Air. Thanks @JeremyPlease for bug reports

Owner

IgorMinar commented Sep 11, 2015

I've updated the gist to v1.0.3 which should do better job of useragent sniffing and support iPad Air. Thanks @JeremyPlease for bug reports

@IgorMinar

This comment has been minimized.

Show comment
Hide comment
@IgorMinar

IgorMinar Sep 11, 2015

v1.1.0 should resolve all of the "flicker" issues seen in apps that use ui-router.

Owner

IgorMinar commented Sep 11, 2015

v1.1.0 should resolve all of the "flicker" issues seen in apps that use ui-router.

@Taylorsuk

This comment has been minimized.

Show comment
Hide comment
@Taylorsuk

Taylorsuk Sep 12, 2015

Fantastic - works well for me...

Fantastic - works well for me...

@tenfef

This comment has been minimized.

Show comment
Hide comment
@tenfef

tenfef Sep 14, 2015

Thanks for the patch. Can you please update the comments from:
dependency on the "ngIOS9Patch" module to your main app module. to
dependency on the "ngIOS9UIWebViewPatch" module to your main app module.

tenfef commented Sep 14, 2015

Thanks for the patch. Can you please update the comments from:
dependency on the "ngIOS9Patch" module to your main app module. to
dependency on the "ngIOS9UIWebViewPatch" module to your main app module.

@Delagen

This comment has been minimized.

Show comment
Hide comment
@Delagen

Delagen Sep 14, 2015

Please add array notation to config call

.config(["$provide", function($provide) {

Delagen commented Sep 14, 2015

Please add array notation to config call

.config(["$provide", function($provide) {

@tobiasmuecksch

This comment has been minimized.

Show comment
Hide comment
@tobiasmuecksch

tobiasmuecksch Sep 14, 2015

Well, as far as I understand this code, everything after line 44 (return $delegate;) is dead code, since it never gets executed (except the function definitions). Am I right? If yes, why?

Well, as far as I understand this code, everything after line 44 (return $delegate;) is dead code, since it never gets executed (except the function definitions). Am I right? If yes, why?

@deebloo

This comment has been minimized.

Show comment
Hide comment
@deebloo

deebloo Sep 14, 2015

@tobiasmuecksch Those are function declaration which are hoisted to the top when the code runs. Therefore they can be placed anywhere the author decides makes them most readable.

deebloo commented Sep 14, 2015

@tobiasmuecksch Those are function declaration which are hoisted to the top when the code runs. Therefore they can be placed anywhere the author decides makes them most readable.

@pille72

This comment has been minimized.

Show comment
Hide comment
@pille72

pille72 Sep 14, 2015

@deebloo does this have any advantages or is this just a different way to write js code?

pille72 commented Sep 14, 2015

@deebloo does this have any advantages or is this just a different way to write js code?

@pcrombach

This comment has been minimized.

Show comment
Hide comment
@pcrombach

pcrombach Sep 14, 2015

After install the patch I get this error in xcode for all phones. iPads are OK

import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
return retVal;
}

With error: Thread 1:signal SIGABRT on int retVal......

After install the patch I get this error in xcode for all phones. iPads are OK

import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
return retVal;
}

With error: Thread 1:signal SIGABRT on int retVal......

@deebloo

This comment has been minimized.

Show comment
Hide comment
@deebloo

deebloo Sep 14, 2015

@pille72 To me it can make your code more readable. The code reads from top down so people see how things are done and then they can go find the implementation details if they need to. For example if you are reading through some code and you see isIOS9UIWebView(), you can assume it will tell you whether or not you are in an IOS9 webview, maybe you don't care how it does it, you just need to know that it does it and you can then go investigate as your need.

tl;dr show anyone reading the code the most important / relevant information first.

deebloo commented Sep 14, 2015

@pille72 To me it can make your code more readable. The code reads from top down so people see how things are done and then they can go find the implementation details if they need to. For example if you are reading through some code and you see isIOS9UIWebView(), you can assume it will tell you whether or not you are in an IOS9 webview, maybe you don't care how it does it, you just need to know that it does it and you can then go investigate as your need.

tl;dr show anyone reading the code the most important / relevant information first.

@col

This comment has been minimized.

Show comment
Hide comment
@col

col Sep 16, 2015

Maybe consider adding "use strict"; at the top of the file. The patch already adheres to strict mode and this will not have any adverse effects for people running on ECMAScript earlier than version 5.

col commented Sep 16, 2015

Maybe consider adding "use strict"; at the top of the file. The patch already adheres to strict mode and this will not have any adverse effects for people running on ECMAScript earlier than version 5.

@col

This comment has been minimized.

Show comment
Hide comment
@col

col Sep 16, 2015

I'm getting a some issues when using minification. Please update the script to support minification.

Example:

angular.module('ngIOS9UIWebViewPatch', ['ng']).config(['$provide', function($provide) {
  ...
}]);

col commented Sep 16, 2015

I'm getting a some issues when using minification. Please update the script to support minification.

Example:

angular.module('ngIOS9UIWebViewPatch', ['ng']).config(['$provide', function($provide) {
  ...
}]);
@marrs

This comment has been minimized.

Show comment
Hide comment
@marrs

marrs Sep 17, 2015

Just came here to say the same thing. Spent the afternoon working this out :)

marrs commented Sep 17, 2015

Just came here to say the same thing. Spent the afternoon working this out :)

@IgorMinar

This comment has been minimized.

Show comment
Hide comment
@IgorMinar

IgorMinar Sep 18, 2015

v1.1.1 is out, I fixed the minification issue as well as the incorrect module name in the comment.

Owner

IgorMinar commented Sep 18, 2015

v1.1.1 is out, I fixed the minification issue as well as the incorrect module name in the comment.

@vasam

This comment has been minimized.

Show comment
Hide comment
@vasam

vasam Sep 18, 2015

where this patch file should be placed? under /angular/ ?

Thanks.

vasam commented Sep 18, 2015

where this patch file should be placed? under /angular/ ?

Thanks.

@dmastag

This comment has been minimized.

Show comment
Hide comment
@dmastag

dmastag Sep 18, 2015

@vasam you can place it anywhere you like since you will include it in your index.html with the path to it

dmastag commented Sep 18, 2015

@vasam you can place it anywhere you like since you will include it in your index.html with the path to it

@jgirdner

This comment has been minimized.

Show comment
Hide comment
@jgirdner

jgirdner Sep 18, 2015

WTH man. Is apple becoming Microsoft? Feel like I am developing for Internet Exploder again.

WTH man. Is apple becoming Microsoft? Feel like I am developing for Internet Exploder again.

@hammady

This comment has been minimized.

Show comment
Hide comment
@hammady

hammady Sep 19, 2015

For those who couldn't get this patch to the rescue, make sure you don't have href="#" on your elements that trigger the $location change.

hammady commented Sep 19, 2015

For those who couldn't get this patch to the rescue, make sure you don't have href="#" on your elements that trigger the $location change.

@F1LT3R

This comment has been minimized.

Show comment
Hide comment
@F1LT3R

F1LT3R Sep 20, 2015

Having trouble getting this patch to work here:

Uncaught Error: [$injector:modulerr] Failed to instantiate module ModuleName due to: Error: [$injector:modulerr] Failed to instantiate module ngIOS9UIWebViewPatch due to: Error: [ng:areq] Argument 'fn' is not a function, got string

screen shot 2015-09-20 at 11 22 14 am

F1LT3R commented Sep 20, 2015

Having trouble getting this patch to work here:

Uncaught Error: [$injector:modulerr] Failed to instantiate module ModuleName due to: Error: [$injector:modulerr] Failed to instantiate module ngIOS9UIWebViewPatch due to: Error: [ng:areq] Argument 'fn' is not a function, got string

screen shot 2015-09-20 at 11 22 14 am

@chrisreed01

This comment has been minimized.

Show comment
Hide comment
@chrisreed01

chrisreed01 Sep 21, 2015

Hi, the patch fixed the issue with my pages, however has now caused errors with two icon buttons on my app landing page which trigger intro tutorials if the first time entering that section of the app. On clicking the icon it just flickers and stays on the menu. Commenting out the tabClick() and replacing with the original URL allows me to enter the next screen (disabling the tutorials) - but would ideally like to have them remain in the app.

homeIcons : [

            {
                title : 'Contacts',
                //state : 'app.upload-device',
                iconOn : 'ion-plus',
                iconOff : 'ion-plus',
                tabClick: 'contactTabClick()'
                //url : '#/app/emergency-profiles'
            },

            {
                title : 'My Trips',
                //state : 'app.upload-camera',
                iconOn : 'ion-ios-people',
                iconOff : 'ion-ios-people',
                tabClick: 'myTourTabClick()'
                //url : '#/app/my-tours'
            },
            {
                title : 'Travel Tools',
                state : 'app.upload-camera',
                iconOn : 'ion-ios-location',
                iconOff : 'ion-ios-location',
                url : '#/app/travel-tools'
            },
        ],

Hi, the patch fixed the issue with my pages, however has now caused errors with two icon buttons on my app landing page which trigger intro tutorials if the first time entering that section of the app. On clicking the icon it just flickers and stays on the menu. Commenting out the tabClick() and replacing with the original URL allows me to enter the next screen (disabling the tutorials) - but would ideally like to have them remain in the app.

homeIcons : [

            {
                title : 'Contacts',
                //state : 'app.upload-device',
                iconOn : 'ion-plus',
                iconOff : 'ion-plus',
                tabClick: 'contactTabClick()'
                //url : '#/app/emergency-profiles'
            },

            {
                title : 'My Trips',
                //state : 'app.upload-camera',
                iconOn : 'ion-ios-people',
                iconOff : 'ion-ios-people',
                tabClick: 'myTourTabClick()'
                //url : '#/app/my-tours'
            },
            {
                title : 'Travel Tools',
                state : 'app.upload-camera',
                iconOn : 'ion-ios-location',
                iconOff : 'ion-ios-location',
                url : '#/app/travel-tools'
            },
        ],
@matthewgerrard

This comment has been minimized.

Show comment
Hide comment
@matthewgerrard

matthewgerrard Sep 21, 2015

Works really for me, thank you :)

Works really for me, thank you :)

@rmjoia

This comment has been minimized.

Show comment
Hide comment
@rmjoia

rmjoia Sep 22, 2015

Guys! Thanks a lot, I was having some issues here, and end up finding this code! I'm integrating an angular.js spa on a webview using appcelerator titanium alloy, this patch did the trick.

rmjoia commented Sep 22, 2015

Guys! Thanks a lot, I was having some issues here, and end up finding this code! I'm integrating an angular.js spa on a webview using appcelerator titanium alloy, this patch did the trick.

@pellekrogholt

This comment has been minimized.

Show comment
Hide comment
@pellekrogholt

pellekrogholt Sep 22, 2015

what about adding a bower.json file:

{
  "main": [
    "angular-ios9-uiwebview.patch.js"
  ],
  "name": "angular-ios9-uiwebview.patch",
  "version": "1.1.1"
}

so it is easy to add this patch to a project within the bower.json of the project:

"angular-ios9-uiwebview-patch": "https://gist.github.com/<revision>.git",

what about adding a bower.json file:

{
  "main": [
    "angular-ios9-uiwebview.patch.js"
  ],
  "name": "angular-ios9-uiwebview.patch",
  "version": "1.1.1"
}

so it is easy to add this patch to a project within the bower.json of the project:

"angular-ios9-uiwebview-patch": "https://gist.github.com/<revision>.git",
@rodrigopuravida

This comment has been minimized.

Show comment
Hide comment
@rodrigopuravida

rodrigopuravida Sep 22, 2015

Thanks a lot for the patch... I was going around and around until I found this :o)

Thanks a lot for the patch... I was going around and around until I found this :o)

@lchenneberg

This comment has been minimized.

Show comment
Hide comment
@lchenneberg

lchenneberg Sep 22, 2015

@IgorMinar it seems you have identified and corrected the issue in angular.
It would be useful if you could give us a fix that correct the iOS9 'window.location' issue on any web applications

@IgorMinar it seems you have identified and corrected the issue in angular.
It would be useful if you could give us a fix that correct the iOS9 'window.location' issue on any web applications

@maciejwitalinski

This comment has been minimized.

Show comment
Hide comment
@maciejwitalinski

maciejwitalinski Sep 22, 2015

It works like a charm! Thank you!

It works like a charm! Thank you!

@ciriac

This comment has been minimized.

Show comment
Hide comment
@ciriac

ciriac Sep 22, 2015

Can confirm that this works. Thanks!

ciriac commented Sep 22, 2015

Can confirm that this works. Thanks!

@Davei234

This comment has been minimized.

Show comment
Hide comment
@Davei234

Davei234 Sep 22, 2015

do you know if its ok to have something like:

<a href ng-click="doStuffThenChangeLocation()">hello</a>

where $scope.doStuffThenChangeLocation is a function that does stuff before changing $location

do you know if its ok to have something like:

<a href ng-click="doStuffThenChangeLocation()">hello</a>

where $scope.doStuffThenChangeLocation is a function that does stuff before changing $location

@digitalcatnip

This comment has been minimized.

Show comment
Hide comment
@digitalcatnip

digitalcatnip Sep 22, 2015

Definitely fixed my issues with Ionic tabs in iOS 9.1 beta! Thanks!

Definitely fixed my issues with Ionic tabs in iOS 9.1 beta! Thanks!

@djburdick

This comment has been minimized.

Show comment
Hide comment
@djburdick

djburdick Sep 22, 2015

Works for me. Thanks!

Works for me. Thanks!

@malwatte

This comment has been minimized.

Show comment
Hide comment
@malwatte

malwatte Sep 23, 2015

I applied the patch and it worked except I came across another issue.
When a user logout from home screen I open login screen. But while the transition is happening Home screen is appearing for a moment behind login page. It is not consistent and happens sometimes. This happens only in iOS 9.
I use
$ionicHistory.nextViewoptions({
disableBack:true,
historyroot:true
});
$state.go('login');
To go to login page

issue

Any one came across such an issue?
Please help.

I applied the patch and it worked except I came across another issue.
When a user logout from home screen I open login screen. But while the transition is happening Home screen is appearing for a moment behind login page. It is not consistent and happens sometimes. This happens only in iOS 9.
I use
$ionicHistory.nextViewoptions({
disableBack:true,
historyroot:true
});
$state.go('login');
To go to login page

issue

Any one came across such an issue?
Please help.

@bentaly

This comment has been minimized.

Show comment
Hide comment
@bentaly

bentaly Sep 23, 2015

THANKYOU!

Been looking for hours for a fix πŸ‘

bentaly commented Sep 23, 2015

THANKYOU!

Been looking for hours for a fix πŸ‘

@svilpikas

This comment has been minimized.

Show comment
Hide comment
@svilpikas

svilpikas Sep 23, 2015

Maybe someone can help me with this ? getting error: uknown provider ngIOS9UIWebViewPatch

Maybe someone can help me with this ? getting error: uknown provider ngIOS9UIWebViewPatch

@macdonaldr93

This comment has been minimized.

Show comment
Hide comment
@macdonaldr93

macdonaldr93 Sep 23, 2015

Amazing! Thank you so much for this fix.

Amazing! Thank you so much for this fix.

@sebalagos90

This comment has been minimized.

Show comment
Hide comment
@sebalagos90

sebalagos90 Sep 24, 2015

Awesome, thanks for the fix.
Angular 1.4.6 doesn't fix this issue completely.

Awesome, thanks for the fix.
Angular 1.4.6 doesn't fix this issue completely.

@mcallisto

This comment has been minimized.

Show comment
Hide comment
@mcallisto

mcallisto Sep 24, 2015

Same for me,

Newer versions of Angular have the workaround baked in.

seems not entirely true for Angular 1.4.6

Same for me,

Newer versions of Angular have the workaround baked in.

seems not entirely true for Angular 1.4.6

@glui2001

This comment has been minimized.

Show comment
Hide comment
@glui2001

glui2001 Sep 25, 2015

It worked for a circumstance I was experiencing with my angular only app. Thank you!

It worked for a circumstance I was experiencing with my angular only app. Thank you!

@agupta1989

This comment has been minimized.

Show comment
Hide comment
@agupta1989

agupta1989 Sep 28, 2015

Worked for me too.. Many thanks ! πŸ‘

Worked for me too.. Many thanks ! πŸ‘

@EeKay

This comment has been minimized.

Show comment
Hide comment
@EeKay

EeKay Sep 28, 2015

It scares the digest warnings away like little kids on a graveyard.. sweet :)

EeKay commented Sep 28, 2015

It scares the digest warnings away like little kids on a graveyard.. sweet :)

@alloyking

This comment has been minimized.

Show comment
Hide comment
@alloyking

alloyking Sep 28, 2015

Works great! @IgorMinar, I appreciate it.

Works great! @IgorMinar, I appreciate it.

@DrMabuse23

This comment has been minimized.

Show comment
Hide comment
@DrMabuse23

DrMabuse23 Sep 29, 2015

if anyone us jshint or jscs here is a gist with https://gist.github.com/DrMabuse23/307d1f81727c0327fff0

if anyone us jshint or jscs here is a gist with https://gist.github.com/DrMabuse23/307d1f81727c0327fff0

@vqoph

This comment has been minimized.

Show comment
Hide comment
@vqoph

vqoph Sep 29, 2015

Worked for me too

vqoph commented Sep 29, 2015

Worked for me too

@azaslavsky

This comment has been minimized.

Show comment
Hide comment
@azaslavsky

azaslavsky Sep 30, 2015

@pellekrogholt and others: I've gone ahead and put this solution up on bower and NPM. Repo is available at https://github.com/azaslavsky/angular-ios9-uiwebview-patch

Bower:

bower install angular-ios9-uiwebview-patch

NPM:

npm install angular-ios9-uiwebview-patch

@pellekrogholt and others: I've gone ahead and put this solution up on bower and NPM. Repo is available at https://github.com/azaslavsky/angular-ios9-uiwebview-patch

Bower:

bower install angular-ios9-uiwebview-patch

NPM:

npm install angular-ios9-uiwebview-patch
@zwallacedev

This comment has been minimized.

Show comment
Hide comment
@zwallacedev

zwallacedev Oct 2, 2015

Using this fix solved my issue with getting the errors. However, now when I use $state.go('urldestination') it takes me to the destination the first time. However, when I use it again... It takes me back to the $urlStateProvider.otherwise('destination');
Any ideas on why this is happening?

Using this fix solved my issue with getting the errors. However, now when I use $state.go('urldestination') it takes me to the destination the first time. However, when I use it again... It takes me back to the $urlStateProvider.otherwise('destination');
Any ideas on why this is happening?

@sangwonl

This comment has been minimized.

Show comment
Hide comment
@sangwonl

sangwonl Oct 4, 2015

It works for me perfectly! Super thanks!!

sangwonl commented Oct 4, 2015

It works for me perfectly! Super thanks!!

@mishitpatel

This comment has been minimized.

Show comment
Hide comment
@mishitpatel

mishitpatel Oct 4, 2015

It worked pretty well. Hope Apple fix the issue on their side as well.

It worked pretty well. Hope Apple fix the issue on their side as well.

@anteksiler

This comment has been minimized.

Show comment
Hide comment
@anteksiler

anteksiler Oct 4, 2015

This is not working for me on Angular 1.4.7 which should have fixed this issue.

This is not working for me on Angular 1.4.7 which should have fixed this issue.

@samrose3

This comment has been minimized.

Show comment
Hide comment
@samrose3

samrose3 Oct 4, 2015

Thank you!! I was going in circles trying to figure out why this was happening! Patch worked like a charm!

samrose3 commented Oct 4, 2015

Thank you!! I was going in circles trying to figure out why this was happening! Patch worked like a charm!

@adexerivera

This comment has been minimized.

Show comment
Hide comment
@adexerivera

adexerivera Oct 5, 2015

Thanks it works perfectly!!!

Thanks it works perfectly!!!

@khurana3192

This comment has been minimized.

Show comment
Hide comment
@khurana3192

khurana3192 Oct 5, 2015

Worked for me as well....Thanx dev

Worked for me as well....Thanx dev

@denstepa

This comment has been minimized.

Show comment
Hide comment
@denstepa

denstepa Oct 5, 2015

big thanks for this fix!

denstepa commented Oct 5, 2015

big thanks for this fix!

@iad42

This comment has been minimized.

Show comment
Hide comment
@iad42

iad42 Oct 5, 2015

thanks! this helped me a lot

iad42 commented Oct 5, 2015

thanks! this helped me a lot

@slashwhatever

This comment has been minimized.

Show comment
Hide comment
@slashwhatever

slashwhatever Oct 6, 2015

I'm running 1.4.3 and for some reason, this fix doesn't work for me: http://puu.sh/kAkGS/ba5f24ef18.png

I'm running 1.4.3 and for some reason, this fix doesn't work for me: http://puu.sh/kAkGS/ba5f24ef18.png

@matthewlloyd

This comment has been minimized.

Show comment
Hide comment
@matthewlloyd

matthewlloyd Oct 7, 2015

Worked for me! My tabs were flickering terribly - now they are perfect. Thank you!

Worked for me! My tabs were flickering terribly - now they are perfect. Thank you!

@philmmoore

This comment has been minimized.

Show comment
Hide comment
@philmmoore

philmmoore Oct 8, 2015

Having the same issues as zwallacedev:

When I use $state.go('urldestination') it takes me to the destination the first time. However, when I use it again... It takes me back to the $urlStateProvider.otherwise('destination');

Anybody else had this when the patch is applied?

Thanks

Having the same issues as zwallacedev:

When I use $state.go('urldestination') it takes me to the destination the first time. However, when I use it again... It takes me back to the $urlStateProvider.otherwise('destination');

Anybody else had this when the patch is applied?

Thanks

@var1ableX

This comment has been minimized.

Show comment
Hide comment
@var1ableX

var1ableX Oct 8, 2015

Yes I still have the issue post patch but it's intermittent. Almost like after a while it goes away and stays away. Prior to patching it was easy to reproduce.

Oh and it might be worth debugging the code that detects ios9 to make sure it's returning true during execution.

function isIOS9UIWebView(userAgent) {
      return /(iPhone|iPad|iPod).* OS 9_\d/.test(userAgent) && !/Version\/9\./.test(userAgent);
    }

Yes I still have the issue post patch but it's intermittent. Almost like after a while it goes away and stays away. Prior to patching it was easy to reproduce.

Oh and it might be worth debugging the code that detects ios9 to make sure it's returning true during execution.

function isIOS9UIWebView(userAgent) {
      return /(iPhone|iPad|iPod).* OS 9_\d/.test(userAgent) && !/Version\/9\./.test(userAgent);
    }
@salman497

This comment has been minimized.

Show comment
Hide comment
@salman497

salman497 Oct 12, 2015

Thanks allot...I was worried as clients reported issues faced in IOS 9...applied you patch and it worked!!

Thanks allot...I was worried as clients reported issues faced in IOS 9...applied you patch and it worked!!

@idir

This comment has been minimized.

Show comment
Hide comment
@idir

idir Oct 12, 2015

Thank you ^^

idir commented Oct 12, 2015

Thank you ^^

@levelup-fx

This comment has been minimized.

Show comment
Hide comment
@levelup-fx

levelup-fx Oct 13, 2015

Our app is stable with your patch. We're still testing, but so far the tab bouncing problem seems gone. Thank you!

Our app is stable with your patch. We're still testing, but so far the tab bouncing problem seems gone. Thank you!

@HarunOr

This comment has been minimized.

Show comment
Hide comment
@HarunOr

HarunOr Oct 14, 2015

Works like a charm !

HarunOr commented Oct 14, 2015

Works like a charm !

@bondseid

This comment has been minimized.

Show comment
Hide comment
@bondseid

bondseid Oct 14, 2015

Thanks a lot!

Thanks a lot!

@bondseid

This comment has been minimized.

Show comment
Hide comment
@bondseid

bondseid Oct 14, 2015

Question,

since making the update and including the patch everything works well. However, window.histroy.back() no longer works.

Is there an alternative way to implement back funcionality?

Thanks

Question,

since making the update and including the patch everything works well. However, window.histroy.back() no longer works.

Is there an alternative way to implement back funcionality?

Thanks

@baligavinod

This comment has been minimized.

Show comment
Hide comment
@baligavinod

baligavinod Oct 15, 2015

Hey Igor, Thanks a lot for this patch! works perfectly πŸ‘

I just wanted to know about the licensing aspects of using this patch. Our application is in production and currently used Angular 1.3.16 and upgrade to 1.4.6 is not yet planned. So does the patch have any licensing restrictions in terms of using it in production?

Regards,
Vinod

Hey Igor, Thanks a lot for this patch! works perfectly πŸ‘

I just wanted to know about the licensing aspects of using this patch. Our application is in production and currently used Angular 1.3.16 and upgrade to 1.4.6 is not yet planned. So does the patch have any licensing restrictions in terms of using it in production?

Regards,
Vinod

@strille

This comment has been minimized.

Show comment
Hide comment
@strille

strille Oct 15, 2015

Looks great... I have one concern though:

It seems this patch doesn't check which version of Angular you're running and then only decorates $browser for the versions where it's needed? I'm slightly worried that if we apply this patch and then upgrade to an Angular version with this fixed baked in, and forget to remove the patch, we could run into subtle problems...

strille commented Oct 15, 2015

Looks great... I have one concern though:

It seems this patch doesn't check which version of Angular you're running and then only decorates $browser for the versions where it's needed? I'm slightly worried that if we apply this patch and then upgrade to an Angular version with this fixed baked in, and forget to remove the patch, we could run into subtle problems...

@brunomonteiro3

This comment has been minimized.

Show comment
Hide comment
@brunomonteiro3

brunomonteiro3 Oct 15, 2015

This issue was driving me nuts. Thank you so much for this patch!

This issue was driving me nuts. Thank you so much for this patch!

@rodrigues327

This comment has been minimized.

Show comment
Hide comment
@rodrigues327

rodrigues327 Oct 16, 2015

Great!!!! Thank you very much!!

Great!!!! Thank you very much!!

@prashantpalikhe

This comment has been minimized.

Show comment
Hide comment
@prashantpalikhe

prashantpalikhe Oct 16, 2015

Thanks for the patch! Works great!

Thanks for the patch! Works great!

@sprsoft

This comment has been minimized.

Show comment
Hide comment
@sprsoft

sprsoft Oct 16, 2015

You saved my day! This issue was annoying me! Thank you so much for this path!

sprsoft commented Oct 16, 2015

You saved my day! This issue was annoying me! Thank you so much for this path!

@courtness

This comment has been minimized.

Show comment
Hide comment
@courtness

courtness Oct 19, 2015

Works great, thanks!

Works great, thanks!

@fanjavaid

This comment has been minimized.

Show comment
Hide comment
@fanjavaid

fanjavaid Oct 20, 2015

Wow it works great! Thank you ^^

Wow it works great! Thank you ^^

@markbrown4

This comment has been minimized.

Show comment
Hide comment
@markbrown4

markbrown4 Oct 21, 2015

I've noticed that the ngAnimate transitions aren't working in ios9's web view when this is used in a cordova app, they do work in Safari in ios9 however.

I've noticed that the ngAnimate transitions aren't working in ios9's web view when this is used in a cordova app, they do work in Safari in ios9 however.

@mudbath

This comment has been minimized.

Show comment
Hide comment
@mudbath

mudbath Oct 22, 2015

Thanks for this!

mudbath commented Oct 22, 2015

Thanks for this!

@maxime-michel

This comment has been minimized.

Show comment
Hide comment
@maxime-michel

maxime-michel Oct 22, 2015

This saved my life, thanks!

This saved my life, thanks!

@truth86

This comment has been minimized.

Show comment
Hide comment
@truth86

truth86 Oct 23, 2015

Perfect works. I think that ionic team have to consider of your code in their framework.
Thanks again... πŸ‘ πŸ‘ πŸ‘

truth86 commented Oct 23, 2015

Perfect works. I think that ionic team have to consider of your code in their framework.
Thanks again... πŸ‘ πŸ‘ πŸ‘

@jackrr

This comment has been minimized.

Show comment
Hide comment
@jackrr

jackrr Oct 23, 2015

This is great, thank you!

jackrr commented Oct 23, 2015

This is great, thank you!

@elloboblanco

This comment has been minimized.

Show comment
Hide comment
@elloboblanco

elloboblanco Oct 25, 2015

Dude this works great! Thanks :) iOS 9.1, Angular 1.4.3

Dude this works great! Thanks :) iOS 9.1, Angular 1.4.3

@polunzh

This comment has been minimized.

Show comment
Hide comment

polunzh commented Oct 26, 2015

Nice!

@tresti88

This comment has been minimized.

Show comment
Hide comment
@tresti88

tresti88 Oct 26, 2015

Yep works great!!

Yep works great!!

@Spymannn

This comment has been minimized.

Show comment
Hide comment
@Spymannn

Spymannn Oct 27, 2015

Hello guys, I'm working on a ionic/angular app, and I used this patch to fix the ios 9 things, but it's not working for me.
It's the 2nd project I used it, it works well on the 1 project, iOS 9.0.2 angular 1.4.7
but it's not working with my 1st project iOS 9.0.2 which was angular 1.4.3 but I update it to angular 1.4.7

Do I have to update to iOS 9.1 to fix this bug ?
thanks

EDIT : I update my iphone to iOS 9.1 and still not working, I have no idea what to do :(

Hello guys, I'm working on a ionic/angular app, and I used this patch to fix the ios 9 things, but it's not working for me.
It's the 2nd project I used it, it works well on the 1 project, iOS 9.0.2 angular 1.4.7
but it's not working with my 1st project iOS 9.0.2 which was angular 1.4.3 but I update it to angular 1.4.7

Do I have to update to iOS 9.1 to fix this bug ?
thanks

EDIT : I update my iphone to iOS 9.1 and still not working, I have no idea what to do :(

@fvaletk

This comment has been minimized.

Show comment
Hide comment
@fvaletk

fvaletk Oct 27, 2015

Works perfectly, Thanks!

fvaletk commented Oct 27, 2015

Works perfectly, Thanks!

@ewhitmore

This comment has been minimized.

Show comment
Hide comment
@ewhitmore

ewhitmore Oct 27, 2015

@Spymannn did it work once you upgraded to 1.4.7?

@Spymannn did it work once you upgraded to 1.4.7?

@lordgreg

This comment has been minimized.

Show comment
Hide comment
@lordgreg

lordgreg Oct 28, 2015

Hi. Using the patch above, we haven't had luck fixing Tab jumping as explained here: ionic-team/ionic#4563

Hi. Using the patch above, we haven't had luck fixing Tab jumping as explained here: ionic-team/ionic#4563

@Spymannn

This comment has been minimized.

Show comment
Hide comment
@Spymannn

Spymannn Oct 28, 2015

@ewhitmore no, unfortunately, this is really weird because I tried it in another project and it works perfectly
I thought that it was fix in angular 1.4.7 but apparently not

@ewhitmore no, unfortunately, this is really weird because I tried it in another project and it works perfectly
I thought that it was fix in angular 1.4.7 but apparently not

@dhyegofernando

This comment has been minimized.

Show comment
Hide comment

Thanks

@ajayparsana

This comment has been minimized.

Show comment
Hide comment
@ajayparsana

ajayparsana Nov 2, 2015

I am working on project for mobile website. I have used Ionic Framework. I am having issue in navigating to next state on safari browser on iOS 9. It is giving Dom 12 exception setRequestHeaderError
I have used above patch as well but still getting error.

-----------------------------Update-----------------------------------------------------------------------
Patch was not working for me. I have used below code and it worked:
add below code in your module

.factory('httpInjector', function () {
        var httpInjector= {
            request: function (config) {

                if(config.headers.Authorization.toLowerCase().trim() == 'basic')
                {
                    if(config.headers.Authorization)
                    {
                        delete config.headers.Authorization;
                    }
                }
                config.headers["Access-Control-Allow-Origin", "*"];
//                config.headers["Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With"];
//                config.headers["Access-Control-Allow-Methods", "GET, PUT, POST"];

                return config;
            }
        };
        return httpInjector;
    }).config(['$httpProvider', function ($httpProvider) {
        $httpProvider.interceptors.push('httpInjector');
}]);

I am working on project for mobile website. I have used Ionic Framework. I am having issue in navigating to next state on safari browser on iOS 9. It is giving Dom 12 exception setRequestHeaderError
I have used above patch as well but still getting error.

-----------------------------Update-----------------------------------------------------------------------
Patch was not working for me. I have used below code and it worked:
add below code in your module

.factory('httpInjector', function () {
        var httpInjector= {
            request: function (config) {

                if(config.headers.Authorization.toLowerCase().trim() == 'basic')
                {
                    if(config.headers.Authorization)
                    {
                        delete config.headers.Authorization;
                    }
                }
                config.headers["Access-Control-Allow-Origin", "*"];
//                config.headers["Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With"];
//                config.headers["Access-Control-Allow-Methods", "GET, PUT, POST"];

                return config;
            }
        };
        return httpInjector;
    }).config(['$httpProvider', function ($httpProvider) {
        $httpProvider.interceptors.push('httpInjector');
}]);
@teddy-lun

This comment has been minimized.

Show comment
Hide comment
@teddy-lun

teddy-lun Nov 3, 2015

It saves my life. Thanks

It saves my life. Thanks

@oguzgelal

This comment has been minimized.

Show comment
Hide comment
@oguzgelal

oguzgelal Nov 3, 2015

Fixed the glitches on ios. Thanks a lot ! πŸ‘

Fixed the glitches on ios. Thanks a lot ! πŸ‘

@kapil019

This comment has been minimized.

Show comment
Hide comment
@kapil019

kapil019 Nov 4, 2015

@IgorMinar All transition issue are resolved except. One black background is showing behind page transition.
Please suggest any option to resolve black background issue.

kapil019 commented Nov 4, 2015

@IgorMinar All transition issue are resolved except. One black background is showing behind page transition.
Please suggest any option to resolve black background issue.

@expleosoftware

This comment has been minimized.

Show comment
Hide comment
@expleosoftware

expleosoftware Nov 4, 2015

You Sir, are a lifesaver - thank you!

You Sir, are a lifesaver - thank you!

@JohnyNogueira

This comment has been minimized.

Show comment
Hide comment
@JohnyNogueira

JohnyNogueira Nov 4, 2015

It works for me perfectly! Many thanks!!

It works for me perfectly! Many thanks!!

@sdidyk

This comment has been minimized.

Show comment
Hide comment
@sdidyk

sdidyk Nov 5, 2015

thx, bro

sdidyk commented Nov 5, 2015

thx, bro

@chabislav

This comment has been minimized.

Show comment
Hide comment
@chabislav

chabislav Nov 6, 2015

@IgorMinar, Thanks a lot brother.

@IgorMinar, Thanks a lot brother.

@HarryWang74

This comment has been minimized.

Show comment
Hide comment
@HarryWang74

HarryWang74 Nov 6, 2015

thanks a lot.

thanks a lot.

@leopiazzoli

This comment has been minimized.

Show comment
Hide comment
@leopiazzoli

leopiazzoli Nov 9, 2015

Thanks man.

Thanks man.

@PedroJusto

This comment has been minimized.

Show comment
Hide comment
@PedroJusto

PedroJusto Nov 9, 2015

@pcrombach did you solve the problem? I have exactly the same problem!!

@pcrombach did you solve the problem? I have exactly the same problem!!

@tekolie

This comment has been minimized.

Show comment
Hide comment
@tekolie

tekolie Nov 10, 2015

Thanks a lot!

tekolie commented Nov 10, 2015

Thanks a lot!

@lvbeck

This comment has been minimized.

Show comment
Hide comment

lvbeck commented Nov 11, 2015

thanks

@johntomcy

This comment has been minimized.

Show comment
Hide comment
@johntomcy

johntomcy Nov 11, 2015

@kapil019 Ionic tip: to prevent flashes of a black background, make sure you set ion-nav-view's background-color to transparent.

https://github.com/Telerik-Verified-Plugins/WKWebView

@kapil019 Ionic tip: to prevent flashes of a black background, make sure you set ion-nav-view's background-color to transparent.

https://github.com/Telerik-Verified-Plugins/WKWebView

@ddbaron

This comment has been minimized.

Show comment
Hide comment
@ddbaron

ddbaron Nov 14, 2015

Bug fixed in Ionic v1.1.1 -> you don't need this patch any more as it is addressed in ios9 location patch ionic-team/ionic@e5b85df

ddbaron commented Nov 14, 2015

Bug fixed in Ionic v1.1.1 -> you don't need this patch any more as it is addressed in ios9 location patch ionic-team/ionic@e5b85df

@swren

This comment has been minimized.

Show comment
Hide comment
@swren

swren Nov 17, 2015

Thank you!! this fixed the issue for my App immediately.

I was getting multiple "[$rootScope:infdig] 10 $digest() iterations reached" errors

Cheers

swren commented Nov 17, 2015

Thank you!! this fixed the issue for my App immediately.

I was getting multiple "[$rootScope:infdig] 10 $digest() iterations reached" errors

Cheers

@asemoon

This comment has been minimized.

Show comment
Hide comment
@asemoon

asemoon Nov 17, 2015

@ddbaron I am running latest version of ionic , however, I am getting "10 $digest() iterations reached" message upon using $state.go. It only happens when I run the app on the device and it seems to be ok when using ionic serve.

asemoon commented Nov 17, 2015

@ddbaron I am running latest version of ionic , however, I am getting "10 $digest() iterations reached" message upon using $state.go. It only happens when I run the app on the device and it seems to be ok when using ionic serve.

@boyfunky

This comment has been minimized.

Show comment
Hide comment
@boyfunky

boyfunky Nov 27, 2015

I'm having a weird issue on iOS whereby i have a form the ppl hv to input their phone numbers nd it saves and displays the number in another page.

I save first number 0123456789 it saves and displays correctly but when i save another number, it attaches the previous number to the new number although in my db it doesn't save both as one number. but somehow this number is cached on my view page nd shows. everything other field shows correctly but only the number field.

Happens only on iOS not on Android

I'm having a weird issue on iOS whereby i have a form the ppl hv to input their phone numbers nd it saves and displays the number in another page.

I save first number 0123456789 it saves and displays correctly but when i save another number, it attaches the previous number to the new number although in my db it doesn't save both as one number. but somehow this number is cached on my view page nd shows. everything other field shows correctly but only the number field.

Happens only on iOS not on Android

@sonukapoor

This comment has been minimized.

Show comment
Hide comment
@sonukapoor

sonukapoor Nov 30, 2015

This patch works fine for AngularJS v1.3.13 as well. Thanks to the Author!

This patch works fine for AngularJS v1.3.13 as well. Thanks to the Author!

@gabrielkaputa

This comment has been minimized.

Show comment
Hide comment
@gabrielkaputa

gabrielkaputa Dec 3, 2015

Thank you!!!!

Thank you!!!!

@renanss

This comment has been minimized.

Show comment
Hide comment
@renanss

renanss Dec 4, 2015

Some heroes doesn't need a cape. They are coder heroes.
You saved our day, thank you so much!

renanss commented Dec 4, 2015

Some heroes doesn't need a cape. They are coder heroes.
You saved our day, thank you so much!

@kettula

This comment has been minimized.

Show comment
Hide comment
@kettula

kettula Dec 9, 2015

Beautiful. Thank you!

kettula commented Dec 9, 2015

Beautiful. Thank you!

@edsykes

This comment has been minimized.

Show comment
Hide comment
@edsykes

edsykes Dec 15, 2015

updating to the latest version of ionic ( 1.1.1 ) also fixes the issue that this patch addresses

edsykes commented Dec 15, 2015

updating to the latest version of ionic ( 1.1.1 ) also fixes the issue that this patch addresses

@srthakkar

This comment has been minimized.

Show comment
Hide comment
@srthakkar

srthakkar Dec 18, 2015

thanks a lot ... its works for me..

thanks a lot ... its works for me..

@sahotataran

This comment has been minimized.

Show comment
Hide comment
@sahotataran

sahotataran Dec 18, 2015

WOrks perfect. thanks πŸ‘

WOrks perfect. thanks πŸ‘

@mathieugerard

This comment has been minimized.

Show comment
Hide comment
@mathieugerard

mathieugerard Dec 29, 2015

Did anyone tried this patch with Cordova-ios 4.0.1? On Cordova-ios 3.9.2, this patch works perfectly but if I update to 4.0.1, I still run into an infinite loop when Angular starts. Using ionic 1.1.1 or 1.2.1 does not make any difference. Thanks

Did anyone tried this patch with Cordova-ios 4.0.1? On Cordova-ios 3.9.2, this patch works perfectly but if I update to 4.0.1, I still run into an infinite loop when Angular starts. Using ionic 1.1.1 or 1.2.1 does not make any difference. Thanks

@Snaddu

This comment has been minimized.

Show comment
Hide comment
@Snaddu

Snaddu Jan 7, 2016

@hammady. Thank you for reminding about this. Solved my case!

Snaddu commented Jan 7, 2016

@hammady. Thank you for reminding about this. Solved my case!

@edmondchui

This comment has been minimized.

Show comment
Hide comment
@edmondchui

edmondchui Jan 8, 2016

Do we need to apply this change if we use ionic 1.2.0?

Do we need to apply this change if we use ionic 1.2.0?

@dorshay6

This comment has been minimized.

Show comment
Hide comment

@mathieugerard same here...

@andriasang

This comment has been minimized.

Show comment
Hide comment
@andriasang

andriasang Feb 29, 2016

@dorshay6, @edmondchui: It's already included in 1.2.0.

@dorshay6, @edmondchui: It's already included in 1.2.0.

@WhiteFangWBC

This comment has been minimized.

Show comment
Hide comment
@WhiteFangWBC

WhiteFangWBC Mar 15, 2016

@IgorMinar: Iam using ionic framework, I found the problem with css "overflow" attribute (using bootstrap class "table-responsive"), at android it's working fine, but at ios9 can't scroll horizontal.

@IgorMinar: Iam using ionic framework, I found the problem with css "overflow" attribute (using bootstrap class "table-responsive"), at android it's working fine, but at ios9 can't scroll horizontal.

@jpike88

This comment has been minimized.

Show comment
Hide comment
@jpike88

jpike88 Mar 25, 2016

Does this patch apply to WKWebView?

jpike88 commented Mar 25, 2016

Does this patch apply to WKWebView?

@mihneasim

This comment has been minimized.

Show comment
Hide comment
@mihneasim

mihneasim Oct 15, 2016

Does any one have a clue if similar patch is needed for ios 10?

Does any one have a clue if similar patch is needed for ios 10?

@ajnrajeev

This comment has been minimized.

Show comment
Hide comment
@ajnrajeev

ajnrajeev Oct 19, 2016

@mihneasim: I found the same issue in ionic app when using com.passslot.cordova.plugin.passbook when testing on ios 10. After invoking the pass screen and clicking on add, navigating away from the app screen that caused the invoke was causing 10 $digest() iterations reached. For now, I have locally added the ios 10 check to the patch for my project and things are working fine.

@mihneasim: I found the same issue in ionic app when using com.passslot.cordova.plugin.passbook when testing on ios 10. After invoking the pass screen and clicking on add, navigating away from the app screen that caused the invoke was causing 10 $digest() iterations reached. For now, I have locally added the ios 10 check to the patch for my project and things are working fine.

@vahidvdn

This comment has been minimized.

Show comment
Hide comment
@vahidvdn

vahidvdn Nov 2, 2016

This didn't solve my problem. My app works fine in android and ios10, but doesn't work nice in some cases in ios9.

vahidvdn commented Nov 2, 2016

This didn't solve my problem. My app works fine in android and ios10, but doesn't work nice in some cases in ios9.

@vineelasanu

This comment has been minimized.

Show comment
Hide comment
@vineelasanu

vineelasanu Feb 8, 2017

Helo I did one hybrid app that was properly working in android, but in iOS its working but getting problem at booking time slots are not working any ideas. here is my screenshot.
screen shot 2017-02-06 at 5 43 09 pm
Thanks in advance.

Helo I did one hybrid app that was properly working in android, but in iOS its working but getting problem at booking time slots are not working any ideas. here is my screenshot.
screen shot 2017-02-06 at 5 43 09 pm
Thanks in advance.

@tuanbs

This comment has been minimized.

Show comment
Hide comment
@tuanbs

tuanbs Mar 17, 2017

I used this patch but still have this issue with Ionic 1.3.2.

tuanbs commented Mar 17, 2017

I used this patch but still have this issue with Ionic 1.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment