Before someone mark this question as duplicate, I did a lot of investigation on this matter and I couldn't found the solution to my problem yet. So, I have these header.html and footer.html files, and I want to load their contents into a new html page (trying to not repeat code). I Know that I can do these in php in a very easy way, but I'm trying to do it with JQuery (just started to dig into it). This is my code so far:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(function(){
$('#filename').load("footer.html");
});
</script>
</head>
<body>
<div id="filename"></div>
</body>
</html>
I am getting the following error:
jquery.min.js:5 XMLHttpRequest cannot load file:///C:/Users/...../footer.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.send @ jquery.min.js:5ajax @ jquery.min.js:5b.fn.load @ jquery.min.js:5(anonymous function) @ index.html:10c @ jquery.min.js:3fireWith @ jquery.min.js:3ready @ jquery.min.js:3H @ jquery.min.js:3