I want to load html snippets into my html page with the following code:
In Firefox and Safari it works perfect, but in Chrome and IE Edge it gives me a cross origin request error:
XMLHttpRequest cannot load file:///../header.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
Are there any workarounds for this error which are working in every of the named browsers?
Answer
You need an http server to request local files.
You can start one easily using python:
python -m http.server 8000
No comments:
Post a Comment