I am trying to build a simple webpage to display a gallery showcasing all of the families my firm has produced for Revit. This will not be hosted on the web, but will just be stored on the server where the families are located. The folders containing the families are located in the same directory as index.html:
.Families
.Details
.Custom
index.html
I'm trying to use this script: How to Load all Images in a Folder, but am getting this error:
XMLHttpRequest cannot load file:///[directory]. Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.
I know that this is a security measure to prevent a website from accessing your local folders, but given that this is only going to exist on the server where the files are located, I'd like to know if there's another option.
Code:
function loadImages(dir){
var fileExtension = ".png";
$.ajax({
url:dir,
success: function(data) {
$(data).find("a:contains(" + fileExtension + ")").each(function () {
var filename = this.href.replace(window.location.host, "").replace("Html:///", " ");
$("body").append($("<img src=" + dir + filename + "></img>"));
});
}
});
}
dir is passed in from another function, and would be something like: "/2014/Custom/Annotations".