Previewing HTML locally
Daniel Mulroy last edited by Daniel Mulroy
For certain rapid development scenarios, I would prefer to download one of my pages and edit it locally with VS Studio, etc.
However, when trying to preview the page locally, I am getting an error with loading certain resources.
Are there changes to the CORS policies or other technical aspects of the page before it will allow you to run the page locally?
Here is an excerpt from the code that is failing:
<link rel="stylesheet" type="text/css" href="//cf.appdrag.com/resources/appallin-universal-theme.css"> <link rel="stylesheet" type="text/css" href="//s3-eu-west-1.amazonaws.com/dev.appdrag.com/resources/css/appdrag.css"> // THIS ONE IS FAILING -> <link rel="stylesheet" crossorigin="anonymous" id="appdrag-palette" type="text/css" href="//app.goodvibes.news/css/appdrag-palette.css"> <link rel="stylesheet" type="text/css" href="//app.goodvibes.news/fonts/fonts.css">
Inspecting the request, it was using http, which was failing. Manually changing the request url to https caused it to work.
Do you know why that one request was being made insecurely? The others were secure, even with the prefix "//url.to.file/"
Wassim last edited by
When using "//" the browser will use http:// when you're on http protocol and https:// on https. What happened might be that all requests went through http because you're local testing but only app.goodvibes.news/css/appdrag-palette.css requires cors headers to allow loading on http.
Manually prepend https: where it doesn't work seems to be the solution!
Daniel Mulroy last edited by
@wassim Brilliant! Merci to you Wassim!