Local storage and Internet Explorer 9 adventures - javascript

I have interesting issue in Internet Explorer 9 using localStorage. I use client-side localization in my web project using i18next library and as a localization storage we decided to use localStorage. We are loading all localization at the user first visit(whole localization for one language ~ 450kb). All is working well in all browser, except Internet explorer 9. After some time and switching between languages I start receiving error - "SCRIPT5022: DOM Exception: QUOTA_EXCEEDED_ERR (22)", when it trying to load localization from server-side. When I try - localStorage.remainingSpace it returns: 120776
However when i try to look what is stored in localStorage with a command - JSON.stringify(localStorage) it returns - "{}". So nothing is stored in localStorage however it writes that only 120kb is free. When I try on any other web site, for the command - localStorage.remainingSpace it shows - 5000000. Also localStorage.clear() is not helping to stop receiving that message - "SCRIPT5022: DOM Exception: QUOTA_EXCEEDED_ERR (22)"
The question is - 'Why internet explorer 9 thinks that localStorage is almost full while it don't contain any data?'
Thanks for any advance.

know how frustrating IE can be. I ran into a similar issue.
Try this this jquery plugin. Also see if this IE9 issue matches your use case
The plugin itself tries various fallbacks short of setting an actual cookie. They integrate several persistence mechanisms in a seamless API regardless of browser, as long as it's on their supported list, it'll work, within the size limitation.
[If 450kb does not fit, try to create a server-backed fallback that actively fetches required keys that are missing from the local storage so that you do not transfer the entire 450k dictionary.]
Best of luck!

Related

Problem loading javascript files in Internet Explorer 11 when accessed using http://localhost/<...>

I have a small html/javascript/jquery based application that uses Jquery Validate plugin for validation purposes. It fails to run in IE11 under certain conditions specified below
The issue is that if I try to access the application using the URL below it doesn't work
http://localhost/myapp/test.html
if I try to access the application using the URL below it works
http://127.0.0.1/myapp/test.html
if I try to access the application from another computer on the LAN
there is no problem
If I reset Internet Explorer settings fully then it starts working on Internet Explorer 11 also.
This behavior cannot be replicated on all IE 11 installed computers
Nothing additional is installed on the problematic computers
Thanks in advance for any tips to resolve this issue
Regards
Mathew
Before answering my question myself I would like to make clarify a statement in the original problem
The statement(s)
The issue is that if I try to access the application using the URL below it doesn't work
http://localhost/myapp/test.html
if I try to access the application using the URL below it works
http://127.0.0.1/myapp/test.html
need to be read as
The issue is that if I try to access the application using the URL below Jquery files are not loaded
http://localhost/myapp/test.html
if I try to access the application using the URL below Jquery is loaded
http://127.0.0.1/myapp/test.html
This was an issue related to the Compatibility settings in Internet Explorer.
It seems that current versions of Jquery will not load in Internet Explorer when it is in Compatibility mode
Resolved the issue by adding the meta tag below to the page header
This disables the use of Compatibility settings in IE

Is IndexedDb dependent on cookie?

I am working on a prototype where we need to support offline data modification of web application, the application is expected to sync back the data when an internet connection is restored. I have taken a look at various HTML5 in-browser storage option and indexeddb looked like the one I wanted. But I am not sure if the data will be persisted between browser close. Is that possible? One more question if I delete the cookie of the browser, will data in indexedDb will be wiped out? My initial tests shows data gets deleted on cookie clear of browser.
If indexeddb is not a viable option, are there any other alternatives to it which can persist data when internet connection is not available?
As per specification database created with indexedDB should be persistent acrross navigation and browser session.
But current implementation is like persistent cookies. So removal of cookies might remove your database too.
As per google chrome indexedDB is a type of temporary storage.
Chrome: https://developer.chrome.com/apps/offline_storage
For microsoft & firefox it is persitent :
Microsoft: https://msdn.microsoft.com/en-in/hh563494.aspx
Firefox: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB
Check supported browsers before use.
http://caniuse.com/#search=indexeddb
It isn't dependent on a cookie, though if you need to know who the user is (likely) you'll probably end up using a cookie of some variety...
As for offline sychronization... I thought about this a lot previously and created a project... The documentation for it is detailed and explains why and how... It may help, or at least give you things to think about. It has very recently been updated to support IndexedDB!
http://forbesmyester.github.io/SyncIt/index.html
In this space there is also RemoteStorage ( they were/are looking at using SyncIt + other bits in the project going forward ), Hood.ie and the commercial FireBase in this field.

Configuring maximum number of simultaneous open WebSockets (in IE)

I've got this JS application. All client side JS communicating with a third party stream server via web sockets. I have about 18 different web sockets open for one page. Firefox and Chrome handle this many open web sockets at once just fine. IE11 seems to have a limitation of 4 open web sockets at once. Once I open that 5th web socket, regardless of socket call to the third-party server, I get an error thrown by IE, which closes the socket and gives the general error "SecurityError" and expanding the proto section it gives me . Seems to be pretty generic errors from my searches. At first I thought there may be a trusted zone type issue with IE, but I've added the client site to my trusted zone as well as the server providing the data.
This post provides info on max number of websockets for Firefox & Chrome, but I don't see anything specific about IE. Are there any known limitations to IE and web sockets? Answered, see edit below.
This MDN site talks about increasing the max value, but again, I can't find anything about IE. Is there some IE setting to up the amount of open connections? Answered: see below edit.
EDIT: This site shows the max connections settings for IE. It looks like it's a registry setting in Windows that controls the amount of web socket connections. Interestingly enough, I don't have that registry Key anywhere, but there is still a limit for this. The page speaks of IE10, and I'm working with IE11 specifically. Does anyone know if there are registry settings for this in regards to IE11? Has anyone just added these feature web socket registry keys and solved this issue?
The MSDN documentation you referenced is clear on the default being 6 concurrent connections (which means if not specified in the registry, that's what you'll get); and, if the documentation doesn't specify differently, it's probably safe to assume newer versions of Internet Explorer act in the same way as version 10.
Try setting through group policy. It worked for me.
https://jwebsocket.org/documentation/reference-guide/internet-explorer-tips

Why does Internet Explorer (or other browsers) use old JavaScript files when I try to debug my ASP.NET program?

I'm changing a .js JavaScript file in my ASP.NET MVC 5 solution, but when I go to debug the program, Internet Explorer 11 frequently loads old JavaScript files (caught chrome doing it too ). What is the problem here, some setting I'm missing? Even if it has the cached JavaScript file in its cache, shouldn't it load the new one with the newer modified date?
You can either read http://fiddler2.com/r/?httpperf to learn how browsers implement caching, or you can simply hit CTRL+F5 to get IE to bypass the cache.
IE cannot magically "know" that the server has a newer version without asking for it, which would defeat the purpose of having a cache in the first place.
change the setting via tools ->Internet options -> advanced -> enable the option empty internet temporary files folder when browser is closed
This worked for me
In explorer settings set the property to get files every time you visit the page.

Any Javascript functions to get homepage ,search provider ,favourites etc from browsers like Firefox and google chrome

my application is setting browserhome page ,search provider ,favourites etc to all supported browsers like googlechrome,firefox,internet explorer.My purpose is to automate my application using selenium .In case of IE these informationa are stored in registry . so it is easy for me to validate the above details .But for firefox and google chrome its bit problem .So i just want know whether there is any functions available in javascript to check browser homepage ,search provider,favourites etc in firefox and google chrome ?
The simple answer is no. It would be a security and privacy issue if client side js code could access that information. Instead you would need to use a browser extension, or in your case you can just use an external program with administrative rights. I am pretty sure that selenium does not have this functionality built in, however it is all available if you know where the browser stores it. IE uses the registry, but chrome and Firefox use proprietary files in their profile directories. There may be an library that does this, otherwise it is possible

Categories

Resources