0

Now the question becomes more weird.

The situation I've described is a local testing environment. And I come through a lot of weird problems as I'm not familiar with Windows development environment. After I added my remote site to "trusted sites", all goes OK. For more details you may visit ActiveX balderdash.

When I say OK, I mean, now the ActiveX component works fine and localstorage is OK, too.


Test environments

  1. Windows 7 sp1 x64, IE 11.0.9600.17691
  2. Windows 8.1 x64, IE 11.0.9600.17690

Test Page source

<!doctype html>
<html lang="en">
 <head>
  <title>Document</title>
 </head>
 <body>
  <object id="ut_atocx" style="visibility: hidden" height="1" width="1"
        classid="clsid:07361D23-67C0-4511-8C89-6DEE3F554446">
    <param name="_Version" value="65536">
    <param name="_ExtentX" value="26">
    <param name="_ExtentY" value="26">
    <param name="_StockProps" value="0">
</object>
<script type="text/javascript">
var client = document.getElementById("ut_atocx");
</script>
 </body>
</html>

Description

My project needs a AtiveX object, and it functions fine until it comes to localStorage. When I opened a regular page, i.e www.bing.com, and hit F12 to open Developers Tools(forgive me if wrong name cause my OS is Chinese edition) ant then console tab, localStorage works fine. When I opened the test page, and do the same things as above, the return value is "undefined". I've searched the Internet and can't find any answers about AtiveX and localStorage. Please help. Thank you.

UnixAgain
  • 437
  • 5
  • 13

2 Answers2

0

LocalStorage requires IE8 or later. The behavior you describe suggests that your local test page is loading in IE7 compatibility view, which can happen if you're loading it from a directory on your local file system.

When you do this, the page is loaded in the Intranet zone by default. (You can change this default, if you like.)

You can also:

Hope this helps...

-- Lance

Community
  • 1
  • 1
Lance Leonard
  • 3,285
  • 3
  • 16
  • 15
  • Thanks for your work. I changed the default version of IE, yet in IE 10, localStorage is undefined too. Now it seems localStorage is not necessary for this project. But I'll check this question out if your other answers work. But how can I use a different browser when ActiveX object is only compatible with IE? – UnixAgain Apr 21 '15 at 07:06
  • The fact that localStorage isn't appearing seem puzzling. Is it possible that it's been disabled by a group policy or other administrative action? As far as the other browser goes, you're right. I was focusing on localStorage, not ActiveX. Sorry. – Lance Leonard Apr 21 '15 at 13:35
0

no when open file html in local with protocol file:// localStorage is undefined

Behnam
  • 6,244
  • 1
  • 39
  • 36