weixin_39833290
2021-01-10 02:04 阅读 107

Uncaught ReferenceError: Window is not defined

i am currently using meteorjs + polymer + cordova to build android application when i run it in android device as cordova app cause an error

I20141230-13:23:05.908(5.5) (android:http://meteor.local/polymer/bower_components/webcomponentsjs/webcomponents.min.js:11) Uncaught ReferenceError: Window is not defined

but it working perfectly in android browser

该提问来源于开源项目:webcomponents/webcomponentsjs

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

22条回答 默认 最新

  • weixin_39928106 weixin_39928106 2021-01-10 02:04

    Do you have a minimal test case you can share that can be used to repro this issue?

    点赞 评论 复制链接分享
  • weixin_39833290 weixin_39833290 2021-01-10 02:04

    https://github.com/HedCET/polymer https://polymer_test.meteor.com online version

    to run that repo in device => meteor run android-device --mobile-server ip:port REF => https://github.com/meteor/meteor/wiki/Meteor-Cordova-Phonegap-integration

    screenshot from 2014-12-31 02 26 56

    same problem in another app => https://github.com/Differential/polymer-demo/issues/5#issuecomment-68401982

    点赞 评论 复制链接分享
  • weixin_39637397 weixin_39637397 2021-01-10 02:04

    +1, appears that webcomponents might break meteor websites in iOS cordova as well:

    
    [Error] Deprecated attempt to access property 'userAgent' on a non-Navigator object.
        global code (webcomponents.js, line 6290)
    
    点赞 评论 复制链接分享
  • weixin_39900676 weixin_39900676 2021-01-10 02:04

    +1, using angularjs polymer. In browser works perfectly.

    In emulator or device cause this error

    
    01-07 12:44:25.160: E/Web Console(17402): Uncaught ReferenceError: Window is not defined at file:///android_asset/www/lib/webcomponentsjs/webcomponents.js:1285
    
    点赞 评论 复制链接分享
  • weixin_39928106 weixin_39928106 2021-01-10 02:04

    I've been able to confirm the above breaks.

    点赞 评论 复制链接分享
  • weixin_39900676 weixin_39900676 2021-01-10 02:04

    Could you solve the problem? Im very happy with polymer :smile:

    点赞 评论 复制链接分享
  • weixin_39900676 weixin_39900676 2021-01-10 02:04

    any news?? polymer is spectacular!

    点赞 评论 复制链接分享
  • weixin_39982236 weixin_39982236 2021-01-10 02:04

    having the same problem on android 4.2.2, the weird issue is my friend can compile and run into it flawlessly.

    E/Web Console﹕ Uncaught ReferenceError: Window is not defined at file:///android_asset/www/bower_components/webcomponentsjs/webcomponents.js:1285

    the difference in my case is I didn't use meteor

    点赞 评论 复制链接分享
  • weixin_39900676 weixin_39900676 2021-01-10 02:04

    news?????? :D

    点赞 评论 复制链接分享
  • weixin_39900676 weixin_39900676 2021-01-10 02:04

    any news please???

    点赞 评论 复制链接分享
  • weixin_39928106 weixin_39928106 2021-01-10 02:04

    We're aware of the issue and are hoping to get to it when time allows. We'll close this issue when that's been completed.

    点赞 评论 复制链接分享
  • weixin_39756540 weixin_39756540 2021-01-10 02:04

    Im having the same issue using the package https://github.com/numtel/meteor-webcomponent

    点赞 评论 复制链接分享
  • weixin_39833290 weixin_39833290 2021-01-10 02:04

    some errors solve with start iron:router after polymer-ready event & load webcomponent.js at head tag, but it always shows blank page in android 4.2.2

    点赞 评论 复制链接分享
  • weixin_39900676 weixin_39900676 2021-01-10 02:04

    thank . Same to me on Android 4.4.2 it always show a blank page.

    点赞 评论 复制链接分享
  • weixin_39738152 weixin_39738152 2021-01-10 02:04

    +1 I am seeing a very similar symptom. In the emulator it works fine, but unfortunately in the actual device it shows a blank page and the error of the window not being defined. Is there a work around meanwhile this is being worked?

    点赞 评论 复制链接分享
  • weixin_39684228 weixin_39684228 2021-01-10 02:04

    I was trying to use Polymer inside a Meteor.js app and I was having all of these issues as well. After being bounced around a few places online to help with the problem, I decided I would try using Crosswalk. After factoring Crosswalk into CordovaLib (at least in Meteor) from what I am able to tell right now, everything in Polymer appears to work great.

    The Meteor resource I followed is below. I found the process very simple. https://meteor.hackpad.com/Building-Meteor-app-with-Crosswalk-kHKh4DzGxFQ

    Perhaps using Crosswalk will solve some of these other issues with other environments as well?

    Note: tested in Android 4.2.2 (HTC 310), 4.3 (Galaxy S3) and 4.4 (Galaxy Tab)

    点赞 评论 复制链接分享
  • weixin_39900676 weixin_39900676 2021-01-10 02:04

    Im using Córdova and polymer. How can i use crosswalk to solve this issue?

    点赞 评论 复制链接分享
  • weixin_39637921 weixin_39637921 2021-01-10 02:04

    Not sure if this helps, but I recently learned that "window" is an object, while "Window" is a native function [note the upper case]. I found that the Android browser throws the "Window is not defined" error for a library I'm building. While on my desktop, in Chrome, Firefox, both Window and window are defined.

    点赞 评论 复制链接分享
  • weixin_39890431 weixin_39890431 2021-01-10 02:04

    Hello, any news on that issue ?

    点赞 评论 复制链接分享
  • weixin_39890431 weixin_39890431 2021-01-10 02:04

    I found two things I hope it will help : - I use myWebView.setWebChromeClient(new WebChromeClient()); It works well with Polymer - and webSettings.setDomStorageEnabled(true); if you want to use localStorage or sessionStorage

    点赞 评论 复制链接分享
  • weixin_39636079 weixin_39636079 2021-01-10 02:04

    I have the same issue on android web browser. Any updates?

    点赞 评论 复制链接分享
  • weixin_39805529 weixin_39805529 2021-01-10 02:04

    Thanks for the issue. It has been a great while since this issue was opened. Sadly, this issue misses a live reproduction with the most recent version of the webcomponents polyfill for us to be able to debug and potentially fix. Versions 1 of the polyfills fix a large amount of issues, probably including this one as well.

    Please see the CONTRIBUTING.md for guidelines on filing issues. You can start from this jsBin template as a starting point and link it in the issue template under "Live Demo".

    Feel free to file a new issue following these instructions if you can still reproduce this issue with versions 1 of the polyfills. Thank you!

    点赞 评论 复制链接分享

相关推荐