Can local files in IE10 use IndexedDB?

I'm trying to write a web app that can be run locally without internet and stores info on the local filesystem and is run in the browser. My code works in Chrome and Firefox but in IE10 I get the error that window.indexedDB is undefined

from the code:

window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
alert( window.indexedDB );

This alerts "undefined" when it should be [object IDBFactory].

Is there a way around this or will IE10 never allow local files to use indexedDB?

Answers:

Answer

IndexedDB instances are tied to the domain which a local file doesn't support. At least this is what is implied by the IndexedDB spec but it's not explicitly spelled out like that.

Some browser (Chrome/Firefox) do implement it for local files but that could be to do with how that handle a "domain" for local files, which is probably different to IE.

The way I get around this is to use node.js and express.js to just serve out the files (and it also means you can avoid the IE security policy warnings), so all I do is:

npm install express

Then use the following file as my JS (saved as app.js):

var express = require('express');
var app = express();

app.use(express.static(__dirname));

app.listen(3000);

And finally run it:

node app.js

This will create a webserver in the following directory serving out all the files from the current directory as static files, so you can easily hit your HTML file without creating routes or anything.

Answer

If you open the IE dev console for an HTML document loaded from the filesystem, you can try to load indexedDB from the console.

When I try, I get the error

DOM7005: Indexed DB is only available on websites with http or https URL schemes.

Bummer. If Node.js isn't an option, there's also IIS Express. 7.5 works all the way back to Windows XP and can even be configured to run out of an XCOPY deployment.

Portable IIS Express instructions

Answer

I've got the joy of IE11 spewing hundreds of those warnings and I'm not even using Indexed DB in any form, its just the Microsoft IE11 debugger shitting the bed for some reason.

"DOM7005: Indexed DB is only available on websites with http or https URL schemes."

starts scrolling down the console when I break and start to want to look at the local variables to see whats what.

What I'm loading, is a local file system SVG graphic that has embedded javascript (ecmascript) to examine, manipulate and return information based on the SVG documents DOM.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.