Reputation: 21
I am trying to figure how you can use javascript to search through the code of all .htm files in a folder A and display on a specific page 1 all the pages in that contain links to page 1. I've come up with an alg for a javascritp code that I figured was simple and should work.
x = filename of current webpage Z;
for every .htm file i in folder A;
for every <href> in file i;
if href's filename = x;
put into iframe of Z, a link to file i;
I am new to scripting so I haven't been able to use the libraries to its full xtent yet. Is there a way to delve through all .htm using javascript and search throguh the code for links?
Upvotes: 0
Views: 85
Reputation: 34169
Javascript in the BROWSER is a client side programming language. Unless you request for all the files via ajax then you need to use something that can be backend.
You can use something else like node.js or php. Node.js is javascript executed not in the browser and instead in the backend.
Upvotes: 0
Reputation: 12700
Typically javascript is client-side and running in the browser. In that context you can't easily get access to the files on the server. You would have to communicate with the server to get that information.
Server-side javascript does exist, but is not common. If you have access to an environment that can execute classic ASP on a Windows Server you can probably run javascript on the server quite easily.
Here is a short article on the subject of server-side javascript.
http://www.sitepoint.com/server-side-javascript-will-be-as-common-as-php/
Upvotes: 0
Reputation: 21466
Are you using Node.js or Javascript in the browser? JavaScript in the browser is all client-side, and has no direct access to the .htm files in a folder.
This is something you would probably be better off using PHP (or other server-side language) for.
Upvotes: 2