You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Shazron Abdullah (JIRA)" <ji...@apache.org> on 2014/09/09 11:51:29 UTC

[jira] [Comment Edited] (CB-6911) iOS 8 - "deprecated attempt to access property" errors when accessing anything off window.navigator

    [ https://issues.apache.org/jira/browse/CB-6911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14126787#comment-14126787 ] 

Shazron Abdullah edited comment on CB-6911 at 9/9/14 9:51 AM:
--------------------------------------------------------------

Solved, I think. 

Add this non-standard (browser support: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__#Browser_compatibility):
{code}
            } else {
                (function(k) {
                    newNavigator.__defineGetter__(k, function(){
                                return origNavigator[k];
                    });
                })(key);
            }

{code}
OR this standard usage (browser support: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__#Browser_compatibility) 
{code}
            } else {
                (function(k) {
                        Object.defineProperty(newNavigator, k, {
                            get: function() {
                                return origNavigator[k];
                            },
                            configurable: true,
                            enumerable: true
                        });
                })(key);
            }
{code}

... by replacing this line: https://github.com/apache/cordova-js/blob/26e3e49e49b2fb61ca836572af85c7a776ea9f1c/src/common/init.js#L58


was (Author: shazron):
Solved, I think. 

Add this:
{code}
            } else {
                (function(k) {
                    newNavigator.__defineGetter__(k, function(){
                                return origNavigator[k];
                    });
                })(key);
            }

{code}
... by replacing this line: https://github.com/apache/cordova-js/blob/26e3e49e49b2fb61ca836572af85c7a776ea9f1c/src/common/init.js#L58

> iOS 8 - "deprecated attempt to access property" errors when accessing anything off window.navigator
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CB-6911
>                 URL: https://issues.apache.org/jira/browse/CB-6911
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: CordovaJS
>         Environment: iOS 8 beta 5 (device)
>            Reporter: Jeff Schilling
>            Assignee: Shazron Abdullah
>         Attachments: Screen Shot 2014-09-01 at 9.03.30 pm.png, Screen Shot 2014-09-04 at 9.30.58 pm.png
>
>
> references to window.navigator.* (platform, geolocation) etc fail with 
> Deprecated attempt to access property 'geolocation' on a non-Navigator object.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)