Phonegap开发者应用程序javascript错误

时间:2015-05-22 18:47:58

标签: javascript cordova internet-explorer windows-phone

我尝试使用" Phongap Developer应用程序运行我的phonegap应用程序"在我的Windows手机上,但它会抛出奇怪的javascript错误,如下所示:

  

对象不支持属性或方法" defineProperty"

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

但是当我用Windowsphone 8.1中的普通浏览器打开html页面时,一切都很完美。 有没有人解释这个问题?

这是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>

1 个答案:

答案 0 :(得分:1)

听起来你的文档被抛入了早期的文档模式,它剥离了Object.defineProperty等现代功能的浏览器。您可以通过记录document.documentMode的输出来检查文档模式。

如果您处于较低文档模式或Quirks模式,则应考虑查找标记是否存在无效HTML或缺少doctype的迹象。一般来说,您应该使用以下doctype启动文档:

<!DOCTYPE html>

从那时起,如果您有有效的标记,您的文档应该以标准模式加载。

相关问题