Ce site disposera de fonctionnalités limitées pendant que nous effectuons des opérations de maintenance en vue de vous proposer un meilleur service. Si un article ne règle pas votre problème et que vous souhaitez poser une question, notre communauté d’assistance est prête à vous répondre via @FirefoxSupport sur Twitter, et /r/firefox sur Reddit.

Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

CORS error. html page cannot access assets folder in parent directory (Firefox, LiveServer, Windows 11)

  • 1 réponse
  • 1 a ce problème
  • 1 vue
  • Dernière réponse par TyDraniu

more options

My html page has a href to ..\assets\style.css and the script.js has a reference to ..\assets\images\backpack.svg

But these files do not display when it is opened in live server. The href is correct because when I type ..\assets\style.css in the Windows File Explorer address bar, it opens the css file correctly.

I tried to load the html directly in Firefox, not LiveServer. I see in the console, Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/Users/Me/Documents/Learn/JS/05_03/Backpack.js. (Reason: CORS request not http).

I posted all the details over here. https://stackoverflow.com/q/70416741/398348

My html page has a href to ..\assets\style.css and the script.js has a reference to ..\assets\images\backpack.svg But these files do not display when it is opened in live server. The href is correct because when I type ..\assets\style.css in the Windows File Explorer address bar, it opens the css file correctly. I tried to load the html directly in Firefox, not LiveServer. I see in the console, Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/Users/Me/Documents/Learn/JS/05_03/Backpack.js. (Reason: CORS request not http). I posted all the details over here. https://stackoverflow.com/q/70416741/398348

Toutes les réponses (1)

more options

This is how it works in Firefox. Going above the html file in a directory tree breaks The Same Origin Policy.