PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, November 2, 2022

[FIXED] How to create a local webserver in cordova android app to use a-frame

 November 02, 2022     android, cordova, file, https, localserver     No comments   

Issue

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?


Solution

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



Answered By - Eric
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing