tkyaji / cordova-plugin-crypt-file

This plugin to encrypt the source files.
Apache License 2.0
179 stars 116 forks source link

CORS issue on Android #9

Closed mcpracht closed 7 years ago

mcpracht commented 8 years ago

Hi,

on Android I am facing the following problem: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

I have already added localhost to whitelisting, but the issue persists. I am using Cordova 5.4.1 on Android Nexus 5 Android version 6.0 and 5.1.1

Any help would be appreciated.

Best regards

kimosabi77 commented 8 years ago

I'm having the same problem with Ionic when loading a video into the html 5 <video> tag.

Url I am using is file://android_asset/www/path/to/video.mp4

iOS is fine.

labteco commented 8 years ago

Yep, here the same.

Moreover, the following errors appear:

deviceready has not fired after 5 seconds.
cordova.js (1183,17)
Channel not fired: onCordovaInfoReady
cordova.js (1176,21)
Channel not fired: onFileSystemPathsReady
cordova.js (1176,21)

Cordova 5.4.0 Android 5.1.1

When everything is running, it could be the most useful plugin so far. Keep up the great work.

tkyaji commented 8 years ago

In android, file:// scheme is replaced with http://localhost/. Therefore, to access local files, you can specify a relative path or "http://localhost/...".

mcpracht commented 8 years ago

I am not only getting this error, when trying to load files from file system, but also when trying to access external urls.

snt4all commented 8 years ago

In android, We are still getting error "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access." As your reference we kept " Access-Control-Allow-Origin: * " in server...and also tried " Access-Control-Allow-Origin: http://localhost "....still error is coming...NO AJAX call is working ...Please help... cordova -6.1.1

int3rnet commented 8 years ago

Getting same error , please your help , i tried to give all CORS for localhost but no luck , ios just works fine.

tkyaji commented 7 years ago

In Android, You need specify the /path/to/video.mp4 or http://localhost/path/to/video.mp4, If you want to access the 'file://android_asset/www/path/to/video.mp4'.