Wednesday 15 June 2011

javascript - Local Webpage - Load images from folder -



javascript - Local Webpage - Load images from folder -

i trying build simple webpage display gallery showcasing of families firm has produced revit. not hosted on web, stored on server families located. folders containing families located in same directory index.html:

.families .details .custom index.html

i'm trying utilize script: how load images in folder, getting error:

xmlhttprequest cannot load file:///[directory]. cross origin requests supported protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.

i know security measure prevent website accessing local folders, given going exist on server files located, i'd know if there's 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 passed in function, , like: "/2014/custom/annotations".

if you're running on chrome, can launch chrome --disable-web-security flag.

javascript jquery html

No comments:

Post a Comment