Question / Help OBS-Browser in v24 breaks local JS fetches

JayP33

New Member
I've been writing html pages for custom overlays that fetches the contents from local text files using JS fetch in a local file html.
JavaScript:
    async function interval() {
      let var = await fetch('../TextFile.txt');
      var = await var.text();
    }
This was working fine until the latest version where the OBS Browser has been updated and now blocks these fetches.
Code:
Fetch API cannot load file:///C:/FilePath/TextFile.txt. URL scheme "file" is not supported.
Uncaught (in promise) TypeError: Failed to fetch (source: file:///C:/FilePath/HtmlFile.html:17)

I've tried passing through command line arguments to allow the local file access, but nothing is working. This worked fine up until the latest OBS Browser Release.

Is this something that can be remedied in a future patch, or do I have to start running a local webserver now?
 

R1CH

Forum Admin
Developer
The file scheme is undefined in the fetch spec, technically it was never guaranteed to work. I think a local webserver is the best way forward for now, browser vendors tend not to care too much about file:// compatibility these days. With the ability to add custom URLs into OBS, we can't disable security to allow file:// access like we used to.
 
Top