Help
Search
Login
Register
Home
Forum: web design and graphics community
Celestial Star Forum
>
Web Development
>
Coding
>
Creating/reading/editing files using Javascript
Pages: [
1
]
« previous
next »
Print
Author
Topic: Creating/reading/editing files using Javascript (Read 520 times)
assie-chan
Retribution
Posts: 156
Creating/reading/editing files using Javascript
«
on:
September 21, 2006, 10:18:35 AM »
I've been reading on this since about yesterday, and I
thought
I had a script that would allow me to create a file, open it, save a string of text to it, close it, and then read it later on.
Alot of the sites I've been to say it's not possible because of security, but alot of them also say that if it's on your local intranet it should, in theory work.
Alas, it's not working in Firefox, I opened up my handy Javascript debugger, and it says "ActiveXObject is not defined", so if it's not defined, then why is it working in Internet Explorer? Here is the code I'm using:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Shangri-la (Option 002)</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<SCRIPT LANGUAGE="JavaScript">
<!--
var TristateFalse = 0;
var ForWriting = 2;
myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
myActiveXObject.CreateTextFile("c:\\savefile.txt");
file = myActiveXObject.GetFile("c:\\savefile.txt");
text = file.OpenAsTextStream(ForWriting, TristateFalse);
text.Write("key_aec73bccd39d5cc726ea564cc49d676f");
text.Close();
// -->
</SCRIPT>
</head>
<body>
<h2>The Prelude</h2>
<form method="get" action="savepoint_01.html">
<input type="submit" value="Save game?">
<form>
<p>
</body>
</html>
Logged
"If Xerxes was two men, and he was the only two men alive, I wouldnt allow him/them to have intercourse."
Vangs
Administrator
Valkyrie Randgris
Posts: 525
Creating/reading/editing files using Javascript
«
Reply #1 on:
October 03, 2006, 06:01:35 PM »
The ActiveXObject looks like a java class to me, I'm no expert with javascript but as far as I know IE has some unique classes that deal with ActiveX controls, which could be why it is only working in IE.
I wouldn't recommend you use this script online at all though, the security flaws in it are unreal!
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General
=> New Members
=> Announcements
=> Support / Suggestions
-----------------------------
Contests
-----------------------------
=> Archive
===> Contests
===> Blend Challenges
===> SOTW
-----------------------------
Art Boards
-----------------------------
=> Creative mediums
=> Requests & offers
=> Tutorials
===> Celestial Star Tutorials
-----------------------------
Web Development
-----------------------------
=> Coding
=> Web Design
=> Advertisements / Affiliation
-----------------------------
Off-topic
-----------------------------
=> Entertainment
-----------------------------
Español (Spanish Only)
-----------------------------
=> General / Bienvenida
=> Anuncios / Ayuda
=> Código / Desarrollo web
Welcome,
Guest
Members login
Register for free
General
General
New members
Announcements
Support / Suggestions
Art boards
Creative mediums
Requests and offers
Tutorials
Celestial Star tutorials
Web development
Coding
Web design
Advertisements / affiliation
Off-topic
The non-sense
Ententainment
Loading...