[ADF-2139] extra cookie availability check (#2865)

* extra cookie availability check

* code style and test fixes

* unit tests
This commit is contained in:
Denys Vuika
2018-01-31 17:37:42 +00:00
committed by Eugenio Romano
parent 900fd70d63
commit 49456b3fcd
4 changed files with 59 additions and 5 deletions

View File

@@ -20,6 +20,16 @@ import { Injectable } from '@angular/core';
@Injectable()
export class CookieService {
isEnabled(): boolean {
// for certain scenarios Chrome may say 'true' but have cookies still disabled
if (navigator.cookieEnabled === false) {
return false;
}
document.cookie = 'test-cookie';
return document.cookie.indexOf('test-cookie') > 0;
}
/**
* Retrieve cookie by key.
*