Question / Help Way to enable local file access for OBS browser source?

sleepdotexe

New Member
As I understand it, OBS Browser sources run on Chromium Embedded Framework. I'm developing an HTML/CSS/JS page which I want to access as a local file in my browser source. However my JS code attempts to access local files (in the same directory as the html page) via fetch. Fetch() works if the files are being served by a web server such as localhost, but if I try to run it as a local file, I get the error:

Fetch API cannot load file:///C:/Users/Aaron/Desktop/twitch%20bot/credits/Labels/weekly_top_cheerer.txt. URL scheme must be "http" or "https" for CORS request.

After doing some research, I believe this is because of Chrome's high web-security standards making it impossible to access local files by default. This can be worked around with command line code such as --allow-file-access-from-files I believe.

Is there a way to enable similar functionality in OBS Browser sources, or to instead choose the browser (i.e. Firefox, Edge, Chrome) that gets used to display a browser source?
 

Vaesive

Member
I still cannot get my browser source that's has file access to work. Works fine in Firefox.
I added --allow-file-access-from-files to my OBS Shortcut Target but it doesn't seem to do anything. I also tried launching OBS with the command prompt run as administrator with the same flag but no luck.
 

Vaesive

Member
Bumping this - Has this been solved at all ? thanks in advance!
If you're using JQuery in you JavaScript and are using the '?' null check operator that's what was (for some reason) causing OBS to barf. Removing the null check for me made everything work.
 
Top