Search code examples
javascriptcordovainternet-explorerwindows-phone

Phonegap developer app javascript Errors


I trying to run my phonegap app with the "Phongap Developer app" on my windows phone, but it's throwing strange javascript errors, like this:

Object doesn't supprt property or method "defineProperty"

       Object.defineProperty(Detail, "name", {
        get: function () { return this._name; },
        set: function (value) { this._name = value; },
        enumerable: true,
        configurable: true
    });

But when I open the html page with the normal Browser from Windowsphone 8.1 everything works perfect. Has some one an explanation for this problem?

This is the Markup of the index.html:

<html>
    <head>
        <script src="Libs/jquery/jquery.js"></script>
        <script src="Libs/angular/angular.js"></script>
        <script src="Libs/angular-ui-router/angular-ui-router.js"></script>
        <script src="Libs/semantic-ui/semantic.js"></script>
        <script src="complete.js"></script>

        <link rel="stylesheet" href="Libs/semantic-ui/semantic.css" />
        <link rel="stylesheet" href="Styles/complete.css" />

    </head>
    <body ng-app="app">
        <ui-view></ui-view>
    </body>
</html>

Solution

  • It sounds like your document is being thrown into an earlier document mode, which strips the browser of modern capabilities like Object.defineProperty. You can check the document mode by logging the output of document.documentMode.

    If you are in a lower document mode, or Quirks Mode, you should consider looking to your markup for any signs of invalid HTML, or a missing doctype. Generally speaking, you should start your document with the following doctype:

    <!DOCTYPE html>
    

    From then on, provided you have valid markup, your document should load in Standards Mode.