Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- requestStorageAccessAndServe() {
- let thisObject = this;
- var promise = document.hasStorageAccess();
- promise.then(
- function (hasCookieAccess) {
- if (!hasCookieAccess) {
- document.requestStorageAccess().then(
- function successful() {
- // reload iframe to run with cookie access
- window.location.reload();
- },
- function fail() {
- thisObject.serveContent(); // Code goes into here
- });
- } else {
- thisObject.serveContent();
- }
- },
- function (reason) {
- thisObject.serveContent();
- }
- );
- }
- requestStorageAccessAndServe() {
- let thisObject = this;
- let hasCookieAccess = !!document.cookie;
- if (!hasCookieAccess) {
- document.requestStorageAccess().then(
- function successful() {
- window.location.reload();
- },
- function fail() {
- thisObject.serveContent();
- });
- } else {
- thisObject.serveContent();
- }
- }
Add Comment
Please, Sign In to add comment