Polymer: Imported resource from origin 'file://' has been blocked from loading by Cross-Origin Resource Sharing policy: Received an invalid response. Origin 'null' is therefore not allowed access.

Created on 14 May 2015  路  12Comments  路  Source: Polymer/polymer

I did the same site as the Making app for 10 minutes , and Chrome
display and white image , the Inspect element was a bug as its title .

Also, bower_components polymer docs index.html was a few files that did not exist . These are:

  • Bower_components / polymer / perf - lib / perf.js
  • Bower_components / polymer / x- elements / x -doc -viewer / x- doc- viewer.html
  • Bower_components / polymer / assets / icons.html

It is a version of the Polymer 0.5 .
Please look at this , I was two or three weeks looked for this.

Most helpful comment

Wait what?? With the "new web" we will no longer be able to open HTML files from local files?? What the hell?? Can someone perhaps point me to some documentation of this?

All 12 comments

Due to the way HTML imports work, Polymer requires a web server. You could try developing using Chrome Dev Editor, which has a built-in web server.

https://chrome.google.com/webstore/detail/chrome-dev-editor-develop/pnoffddplpippgcfjdhbmhkofpnaalpg

By design HTMLImports can only load resources from the same (non-file) domain or domains that support CORS.

Those docs are old and vestigial, thanks for pointing out. We'll remove. The PRIMER.md and polymer-project.org website should be used for docs.

You could alwasy just set up your own node server and then you can present these locally instead of pushing them to your own testing server.

How about using polymer inside cordova ?

We could easily start a web server by using python:
python -m SimpleHTTPServer 8000

You can consider using polymer starter kit as well and install the local development server.
The instructions are on the following link.
https://developers.google.com/web/tools/polymer-starter-kit/

Wait what?? With the "new web" we will no longer be able to open HTML files from local files?? What the hell?? Can someone perhaps point me to some documentation of this?

@stevenroose Opening an HTML file directly will work just fine via a file protocol URL. However, HTMLImports cannot load data via that protocol.

Opening an HTML file directly will work just fine

Only when that file doesn't import other files. What if I want to create an offline-capable browser dashboard that does use htmlimports?

Operating offline isn't the issue. The protocol is the issue. file:// requests will not work, but you can run a local web server (polymer serve, express, etc.) to use HTTP requests instead. You could even use the following Chrome extension to run a local web server.

https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en

@stevenroose , this isn't an issue in Edge

Was this page helpful?
0 / 5 - 0 ratings