OBS cannot access local files from local HTML JavaScript

Vaesive

Member
I cannot for the life of me get OBS to show a simple HTML file with some JavaScript that reads from a local txt file in the same directory that the html file lives. Everything works fine with Firefox and Chrome with no console or JS errors.

Things I've tried:
  • Adding --allow-file-access-from-files to my OBS shortcut and running as administrator.
  • Running OBS through command line as administrator with the --allow-file-access-from-files flag.
  • Enabling/Disabling Hardware Acceleration for Browser Sources.
  • Unchecking "Local File" and putting file:/// before the full filepath to the html file.
Anyone have any ideas? I'm going insane here...

I've zipped up my entire project just for simplicity
 

Attachments

  • SubWall.zip
    41 KB · Views: 174

R1CH

Forum Admin
Developer
 

Vaesive

Member
The logs led me to the fix, thank you! Apparently, OBS doesn't like the short-hand null check character (?) or something? I removed it from a null check and things worked fine.

Thank you!
 

Vaesive

Member
I'm using JQuery in my javascript and was using the '?' (shorthand null check) operator.

Line 54 in the attached zip
var rawSubs = readTextFile("subs.txt")?.split(";");

That line is essentially saying "perform split operation if the expected text file is not null". I removed the '?' and it worked fine in OBS.
 
Top