I’ve been working on a website, using html,css,js and xml files on my computer (not online yet). I had an images folder, but otherwise was keeping all the files in the same folder. As the work progressed, things started to get somewhat messy, so I created css, js, and xml folders and carefully updated all my html, css, and js code. I immediately ran into the “Access to restricted URI denied code: 1012” error, discussed here, here, and here. Following the recommendation in the last link, I moved the site into my localhost server. This seems to have solved the 1012 error, but I still appear to be getting other errors (my js code seems to be having problems accessing html elements). Without being too specific, what are the problems and corresponding solutions relating to moving website files into subdirectories?
Share
When moving style sheets to a
cssfolder, just add./css/to the front of yourhrefs in all your csslinks. Also add../the the front of all the image URLs in your css files.Moving javascripts to a
jsfolder is similar, just add./js/to the front of yourhrefs in all your jslinks.Moving
.xmls to anxmlfolder can be more involved. Due to the 1012 error, you need to move you site to a server, if it isn’t already on one. Then you need to go through your js code and add./xml/to the beginning of your xml references. If you’ve been good, you’ll have a function called something likefunction openXMLfile(xmlFileName)and so you’ll only need to change a single line:xmlhttp.open("GET", xmlFileName+".xml", false);toxmlhttp.open("GET", "./xml/"+xmlFileName+".xml", false);Thanks for other answers and comments. Helped. Upvoted.