jeudi 30 janvier 2020

How do I use 'fs' in a JavaScript file on my website?

I am trying to create code that replaces links to files if the file was deleted, or was never created. It is for a school project. I tried using jQuery, and that broke the website. I tried other pure JavaScript methods, all crashed my site.

I have code that gets a file based on the date, and then use that as an href for a popup. I want to make the popup's href to change from a video file to an html document, 'noSchool.html', if there is no video file found in the directory for my site. I've also tried using fs, like other people have suggested on here, but the console keeps throwing errors saying 'require is not defined' or 'Cannot use import statement outside a module'.

What can I do to get this to work?




Aucun commentaire:

Enregistrer un commentaire