Home > Net >  How to create a local webserver in cordova android app to use a-frame
How to create a local webserver in cordova android app to use a-frame

Time:10-26

I'm trying to use a-frame in my Cordova android app but when I try to access other local files or https websites I get an error telling me I can't work from file://:

HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server

My question is: how can I use a local server in my Cordova app? or are there any alternatives?

CodePudding user response:

Set a hostname to your app

 <preference name="hostname" value="com.myapp" />

So your content is served over https://com.myapp then you will load from https and not file:// anymore

  • Related