View Full Version : changing a html file's name by js

05-23-2012, 05:33 PM
can it be done? If yes then how?

Philip M
05-23-2012, 05:48 PM
can it be done? If yes then how?

No. JavaScript running in a browser is a client-side language. JavaScript does not have any commands for reading or writing files. Modern browsers can read files on the server using an Ajax call, but otherwise JavaScript has no capability to read from, write to, modify or delete a file (except a cookie), communicate with the server, access a database, the client's operating system or the Windows registry, or alter the default behaviour of the browser. And for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.

Why do you want to do this anyway?

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.