I want to load html snippets into my html page with the following code:
<div data-include="header"></div>
<script>
$(function(){
var includes = $('[data-include]');
jQuery.each(includes, function(){
var file = '_HTML/' + $(this).data('include') + '.html';
$(this).load(file);
});
});
</script>
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?