www.webdeveloper.com
Results 1 to 9 of 9

Thread: how to save user preferences from html page on local hard drive with IE9

  1. #1
    Join Date
    Apr 2011
    Posts
    13

    how to save user preferences from html page on local hard drive with IE9

    I have a webpage that I view from my local hard drive. I can't view this file from a server. I am using localstorage to set the user preferences and that works with Chrome but I need to use IE9. What is the best way to set the user preferences?
    The file is named "myfile.html" and the file is located on my PC at c:\myfile.html when I open the file in Chrome the localstorage works fine, when I open the file with IE9 the localstorage does not work. I need a way to save the user preferences. I don't think cookies work for html files that are opened from a PC hard drive.

  2. #2
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    873
    Well, there really isn't much good news for you here. IE9 disables the localStorage system for local files so it won't be of any use to you in IE9. Cookies unfortunately do not work at all on local files as they require http (via a server supporting http).

    There just isn't any way to store data from local web pages without some sort of third party system or server. I'm not sure what kind of page you have or what it is used for but you can always install PHP and gain filesystem access for storing data or even take it a step further and also install MySQL. But as far as pure HTML and Javascript go, you can't really store data from local webpages if you want it to work across multiple browsers.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  3. #3
    Join Date
    Apr 2011
    Posts
    13
    Thanks for the news even if it was bad. I thought that was the case but I was hoping there might be some sort of hack to make it work. The user/viewer can't install PHP, etc., it's just plain IE9. The file doesn't need to be viewed with Chrome, only IE9. I guess I'm just going to have to put this is on a web server and view it from the server instead of from the hard drive.

  4. #4
    Join Date
    Apr 2011
    Posts
    13
    Is it possible to have the html file on the PC hard drive but save the user preferences to a web server? Can localstorage do this with IE9?

  5. #5
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    you can save the file as ".hta" instead of ".html" and use an <application> tag to turn IE9 into an unlocked scripting runtime.
    you'll be able to write and read an ini file if localStorage or the ie "storage behavior" won't work.

  6. #6
    Join Date
    Apr 2011
    Posts
    13
    Very interesting, I don't know anything about .hta or the <application> tag but I will study that option and see if I can get that to work. I like the idea of a .ini file, can the .ini file be stored on a server if I can't write to the users hard drive?

  7. #7
    Join Date
    Apr 2011
    Posts
    13
    I was not able to get the .hta option working, however, I was able to save the user preferences by using "PersistJS: Cross Browser Client-Side Persistent Storage Without Cookies" http://pablotron.org/?cid=1557.
    The problem is that it works with IE7 but it does not work with IE9. I will post the code as a new thread. Thanks for all your help.

  8. #8
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    Quote Originally Posted by RCgua View Post
    I was not able to get the .hta option working, however, I was able to save the user preferences by using "PersistJS: Cross Browser Client-Side Persistent Storage Without Cookies" http://pablotron.org/?cid=1557.
    The problem is that it works with IE7 but it does not work with IE9. I will post the code as a new thread. Thanks for all your help.
    if it works in 7, it should work in 8. you can set the ie compat meta to trick IE9 into 7 or 8 mode instead of edge.

  9. #9
    Join Date
    Apr 2011
    Posts
    13
    Thanks, I found some good information about how to do that at this link http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx. I'll give it a try and post back.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles