0

today i created a html doc. to code a login and registration website. My idea was the following: When you create an account, your data should be save in a text file (unsafe). When you log in, the code should compare the input with the data in the file. But when I want to initialize a variable for my File, Internet Explorer shows the following error: SCRIPT445: This object does not support this action. The marked line I have here:

//Here is the layout creation...
<script>
  function login() 
  {
    var username = document.getElementById("txtusername").value;
    var kennwort = document.getElementById("txtpassword").value;
  }
  function register()
  {
    var rusername = document.getElementById("txtrusername").value;
    var remail = document.getElementById("txtremail").value;
    var rkennwort = document.getElementById("txtrpassword").value;
    var rconfirmpassword = document.getElementById("txtrconfirmpassword").value;
    if(rpassword!=rconfirmpassword)
    {
      alert(unescape("The passwords do not match!", "Error"));
      return;
    }

    //This line creates the error
    var file = new File("C:/Users/Konsicoder/Desktop/Data/data.txt");
    //This line creates the error

    alert("Success!", "Success");
  }
</script>
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
Konsicoder
  • 29
  • 7

1 Answers1

-2

Instead of providing a local file system path and instantiating a File object, you'll likely need to use the browser file selector to be able to first get a handle of the local file.

[http://www.html5rocks.com/en/tutorials/file/dndfiles/][1] [Reading files in JavaScript using the File APIs][1]

Here is a post on SO with details about how a File object can be instantiated: How to instantiate a File object in JavaScript?

Community
  • 1
  • 1
DenizEng
  • 400
  • 4
  • 14
  • See? That's the problem when someone links the solution to something in an answer. It's gone. 404. Puff, There's no more solution for this question. – GustavoCinque Feb 24 '17 at 18:03