load unity webgl from local storage

Having problems with building or using the JCEF Java binding? Ask your questions here.

load unity webgl from local storage

Postby eslammohamed » Thu Oct 11, 2018 2:00 pm

when i try to load unity webgl content i get this error

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.", source: file:///home/ea/Downloads/characterWebGL/Build/UnityLoader.js (1)

how to resolve it?
eslammohamed
Techie
 
Posts: 13
Joined: Wed Oct 10, 2018 7:20 am

Re: load unity webgl from local storage

Postby magreenblatt » Thu Oct 11, 2018 2:12 pm

I suggest asking in a forum appropriate to your unity plugin.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: load unity webgl from local storage

Postby eslammohamed » Thu Oct 11, 2018 2:49 pm

i try this code but not work

CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = false;

ArrayList<String> args = new ArrayList<>();
args.add("--disable-web-security");
args.add("--allow-file-access-from-files");

cefApp_ = CefApp.getInstance(args.toArray(new String[args.size()]),settings);
eslammohamed
Techie
 
Posts: 13
Joined: Wed Oct 10, 2018 7:20 am

Re: load unity webgl from local storage

Postby eslammohamed » Thu Oct 11, 2018 2:54 pm

i had run it before with CSharpCEF with set BroswerSettings.allow_file_access_from_files=true;

but i don't find like this in jcef , so i ask how to execute this flag , i tried the above code but it not run and get error
eslammohamed
Techie
 
Posts: 13
Joined: Wed Oct 10, 2018 7:20 am

Re: load unity webgl from local storage

Postby magreenblatt » Thu Oct 11, 2018 3:04 pm

You should host the content using a local web server or via a resource handler (see CefRequestHandler.getResourceHandler).
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: load unity webgl from local storage

Postby eslammohamed » Thu Oct 11, 2018 4:05 pm

please can you give any example for getResourceHandler()
eslammohamed
Techie
 
Posts: 13
Joined: Wed Oct 10, 2018 7:20 am

Re: load unity webgl from local storage

Postby eslammohamed » Fri Oct 12, 2018 8:38 am

i implement onBeforeCommandLineProcessing inside appHandler and every thing ok now , thank you


CefApp.addAppHandler(new CefAppHandlerAdapter(null) {
@Override
public void stateHasChanged(org.cef.CefApp.CefAppState state) {
// Shutdown the app if the native CEF part is terminated
if (state == CefAppState.TERMINATED) {
System.exit(0);
}
}


@Override
public void onBeforeCommandLineProcessing(String s, CefCommandLine cefCommandLine) {
cefCommandLine.appendSwitch("disable-web-security");
cefCommandLine.appendSwitch("allow-file-access-from-files");
super.onBeforeCommandLineProcessing(s, cefCommandLine);
}
});
eslammohamed
Techie
 
Posts: 13
Joined: Wed Oct 10, 2018 7:20 am

Re: load unity webgl from local storage

Postby ndesktop » Fri Oct 12, 2018 11:21 am

eslammohamed wrote:please can you give any example for getResourceHandler()

https://bitbucket.org/chromiumembedded/ ... terception
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: load unity webgl from local storage

Postby eslammohamed » Fri Oct 12, 2018 3:21 pm

thank you for getResourceHandler example
eslammohamed
Techie
 
Posts: 13
Joined: Wed Oct 10, 2018 7:20 am

Re: load unity webgl from local storage

Postby eslammohamed » Fri Oct 12, 2018 3:22 pm

ndesktop wrote:
eslammohamed wrote:please can you give any example for getResourceHandler()

https://bitbucket.org/chromiumembedded/ ... terception



thank you
eslammohamed
Techie
 
Posts: 13
Joined: Wed Oct 10, 2018 7:20 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 14 guests