Skip to content

Commit

Permalink
hasIndexedDB works when third party cookies off
Browse files Browse the repository at this point in the history
Similar to the other try/catch statements used for checking storage, we need to wrap hasIndexedDB as well.

When third party cookies are disabled and fingerprintjs runs in an iframe then trying to access indexedDB would result in an exception preventing the fingerprint from bring calculated.
  • Loading branch information
leafo authored Nov 8, 2016
1 parent 92e029f commit 60b81c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fingerprint2.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,11 @@
}
},
hasIndexedDB: function (){
return !!window.indexedDB;
try {
return !!window.indexedDB;
} catch(e) {
return true; // SecurityError when referencing it means it exists
}
},
getNavigatorCpuClass: function () {
if(navigator.cpuClass){
Expand Down

0 comments on commit 60b81c6

Please sign in to comment.