Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q19

Feedback on: irt.org FAQ Knowledge Base Q19

Sent by andre de bruin on February 02, 2000 at 19:57:58: - feedback #786

Length:
Too short

Comments:
I guess that there is a reason these answers are not in the FAQ and I just wasted my and your time ?

1) There is a method to read a file in NETSCAPE (through the Java class)

2) depending on what you want to do with the file, this me be a solution:
a) create a separate (invisible) frame
b) use parent.FRAMENAME.location = "yourfile.htm" to load the file in that frame
c) The file is loaded, you can not read the lines from within Javascript (but you can read all the hrefs and anchors
d) there are no security violations when the file is on the same host (and path?) as the loading file.
e) very kinky is to have javascript in that file that is being loaded, code that is activated with an onLoad()
f) Even more kinky is to have the loaded file after doing whatever work it needed to do, perform a document.location = "anotherfile.htm" ON ITS OWN FRAME. I used this method to make a search application with "unlimited" data input: the loaded scripts output their data to a common frame.


Sent by Shyamala k. on June 21, 2000 at 04:49:05: - feedback #1408

Comments:
To read and write into a flat file use Jscript's ActiveXobject. This solves the problem


Sent by Greg Lewis on November 09, 2000 at 02:05:09: - feedback #1975

Technical:
Not technical enough

Comments:
there is a way in netscape to do this and I am sure Internet explorer can also. Below I have code that can read any file on the clients machine, but only with their approval. This code only works on Netscape:

function readFromFile(filename) {
var text = ""
var filechar
netscape.security.PrivilegeManager.enablePrivilege('UniversalFileAccess')
var file = new java.io.File(filename)
var FileReader = new java.io.FileReader(file)
filechar = FileReader.read()
while (filechar != -1) {
text = text + String.fromCharCode(filechar)
filechar = FileReader.read()
}
FileReader.close()
return text
}



©2018 Martin Webb