Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by FernandoDS · Sep 04, 2015 at 10:07 PM · androidandroidpluginwebrequestlocalhost

How to make a Cross Origin Request work on Android

Hi, there!

I have an HTML Game saved to the internal memory of an Android tablet. I'm trying to run it without leaving Unity using a Webview Plugin from Gree: https://github.com/gree/unity-webview

I've worked most of the details out so far, but I'm stuck with a limitation from Android's side. The game needs to make some Cross Origin Requests, which Android does not allow when you try to access file:// . Instead, I'm requried to use http:// , https:// or data://

 08-31 18:35:52.163  20063-20063/com.CompanyName.ProjectName I/chromium﹕ [INFO:CONSOLE(0)] "XMLHttpRequest cannot load file:///storage/emulated/0/Android/data/com.CompanyName.ProjectName/files/GameName/frameworks/cocos2d-html5/moduleConfig.json. Cross origin requests are only supported for protocol schemes: http, data, https.", source:
 file:///storage/emulated/0/Android/data/com.CompanyName.ProjectName/files/GameName/index.html (0)

I've worked with two possible solutions:

  1. Creating a Localhost on the application so I can access it using http://

  2. Bypassing the restriction by tricking Android (as mentioned here: http://stackoverflow.com/questions/10620417/access-local-file-in-a-webview)

Still, I wasn't able to figure out how to implement any of these options. Does anyone have ideas on how to go about this? Or perhaps another solution I haven't thought of?

Also, if anyone needs more info, I'd be glad to provide it.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Goa · Mar 07, 2017 at 11:44 AM 0
Share

Hi,

I have the same exact problem, did you manage to solve it?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ProbePLayer · Apr 15, 2018 at 04:29 PM

Maybe this could work If the smartphone browser is chrome? https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related?hl=en

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

30 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

fingerprintjs integration / NoClassDefFoundException 0 Answers

How to use gradle's buildTypes, productFlavors, sourceSet and other features to batch build apks for different android channel in unity 0 Answers

How do I create an Android Fragment 'over' the Unity player. 0 Answers

Android plugin crash when development build is disabled 0 Answers

Play Store AdMob permissions 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges