Using polymer.js when files are going to be served from file://

318 views
Skip to first unread message

Mostafa Rokooie

unread,
May 14, 2014, 5:09:55 PM5/14/14
to polym...@googlegroups.com
Hi guys,

I'm trying to test Polymer in my web/mobile app, because it's using html imports how can I be able to serve files on file:// and use Polymer?

I think html imports is using XHR to load imported file, and it's impossible to do XHR with file:// because of CORS.

Best,
Mostafa

Rob Dodson

unread,
May 14, 2014, 5:13:11 PM5/14/14
to Mostafa Rokooie, polymer-dev
If you're building a mobile website you should be able to run a local server to preview everything. On mac you can quickly do that by running:

python -m SimpleHTTPServer

from the root of your project in terminal. If you're on Windows you could setup Apache or use something like XAMPP


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CAH60%3DdpjK540pGiwPsQY2c0CA-oCfJPqd7d%3D0g2EOpMWFbF6XQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Mostafa Rokooie

unread,
May 14, 2014, 5:35:48 PM5/14/14
to Rob Dodson, polymer-dev
Of course I can, but the problem is when I'm going to package the app using phonegap. On the mobile phone I have not a python SimpleHTTPServer or something like that.

Eric Bidelman

unread,
May 14, 2014, 8:23:42 PM5/14/14
to Mostafa Rokooie, Rob Dodson, polymer-dev
I'm not Cordova expert, isn't there a permission for accessing local files?


Alternatively, you could use Vulcanize to crush all of the imports and inline everything int your main page.


Mostafa Rokooie

unread,
May 15, 2014, 3:20:02 AM5/15/14
to Eric Bidelman, Rob Dodson, polymer-dev
Thank you Eric, I think this Vulcanize could be a very good solution to package application for mobile.

yagyesh...@itpeoplecorp.com

unread,
Jul 2, 2014, 12:08:48 PM7/2/14
to polym...@googlegroups.com, ebi...@gmail.com, robd...@google.com, mostafa...@gmail.com
Can you share your experience with bundling Polymer app with Cordova? I tried the same and was able to load & view page by Vulcanize suggestion from Eric. However, Polymer web components are neither working as expected nor animating on iOS (iPhone Simulator, iOS 6.1). Did you face issues like this?

Martin Kleinschrodt

unread,
Jul 3, 2014, 8:23:50 AM7/3/14
to polym...@googlegroups.com, ebi...@gmail.com, robd...@google.com, mostafa...@gmail.com, yagyesh...@itpeoplecorp.com
Actually, vulcanizing is not actually necessary for bundling your app with Cordova since the same-origin-policy restrictions do not apply there. I've successfully deployed an app on both iOS and Android with Cordova and I haven't faced any issues so far. I haven't tested any of polymers ui components, though.

yagyesh...@itpeoplecorp.com

unread,
Jul 3, 2014, 8:45:08 AM7/3/14
to polym...@googlegroups.com, ebi...@gmail.com, robd...@google.com, mostafa...@gmail.com, yagyesh...@itpeoplecorp.com
Yeah that right. Building webapp with Cordova is proven solution. What i'm more interested is to know if it would be wise to adopt Polymer for developing smartphones app? So far in my limited trials and testing, Polymer web components did not seem to work on webviews. Has anyone else tried it and got it working?
Reply all
Reply to author
Forward
0 new messages