"nui://" and Fetch API


#1

Fetch requests are not allowed for the scheme “nui”.


#2

Probably impossible to resolve without heavily patching Chrome, CEF developers suggest to make pages all load adding protocol handlers for https, but this would conflict with the NUI handler namespace, also backward compatibility constraints.

Perhaps we should add this to a new manifest where NUI callbacks get some new scheme/hostname and NUI page itself gets loaded from https:// virtual schemes…


#3

Can you sneak iframe sandboxing and fake-top in that update? As it stands you can’t load external resources that block being framed. Also not sure I trust how fivem treats the urls for the nui communications. Why isn’t it a separate schema?

Another thing that would be cool is image support similar to the scaleforms, with img://.


#4

that’d require changes to CEF/Chrome itself again which is outside of the scope for this project.

… ‘trust’?

As said, Chrome has restrictions on protocols that aren’t http:// or https://, you simply can’t make anything that XHRs POST data to a custom scheme in certain cases.

References:
http://magpcss.org/ceforum/viewtopic.php?f=6&t=774
http://magpcss.org/ceforum/viewtopic.php?f=6&t=13266
http://magpcss.org/ceforum/viewtopic.php?f=6&t=13901

Again way out of scope, the browser runs completely separately from the game environment and integrating it so it can use TXDs is near-impossible as both run in entirely separate processes…

In addition, TXDs:

  • only exist in GPU memory
  • are usually using compressed formats that browsers don’t support
  • would be somewhat possible to add but it’d be REALLY slow and CPU-heavy as it’d involve marshaling across 5 threads+ and converting pixel formats and reading data from GPU memory to host memory that it makes more sense to just add the images you need as PNG/JPG somewhere