Question:
How do you load an external page with Javascript?
Where's The Brain
2006-04-22 21:23:16 UTC
Is there a way to get the content from an external file and load it into Javascript, using only Javascript? Like the readfile() function in PHP.
Three answers:
Kaushik
2006-04-26 23:18:25 UTC
The above answers is to load a .js file not for reading any other file



Do you mean to read a file in local?

Yes it can be done. Many say javascript cant handle with files but it can be done. But a dis-advantage is norton script blocking blocks it as malicious scripts and doesnt allow you. However, you may display a alert to the user that he/she shld allow it for your page to work. It uses FileSystemObject to handle and Windows Script Host to run, terminate, etc files.



Here are the links:



FileSystemObject:

http://yaldex.com/wjscript/jsfsotutor.htm

WScript.Shell:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/7b956233-c1aa-4b59-b36d-f3e97a9b02f0.asp
?
2016-12-01 05:50:00 UTC
even as utilising SHTML, or own abode web page, or Coldfusion, or many different languages - you should use what's termed an "contain". Which does precisely what you opt for, contain a unmarried record on distinct pages so that you in person-friendly words ought to edit code in a unmarried position. notwithstanding, and im more desirable than prepared to be corrected in this, i do not imagine there is any thanks to apply incorporates in bathroom-wide-spread HTML. Edit: or use templates like pete says - stupid me!
nogoodaddress
2006-04-22 21:27:00 UTC
There's an article below that can explain for you.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...