Last active
June 13, 2018 10:59
-
-
Save msaxena25/9fac1aa729ff5b6f1f93a2441228fa36 to your computer and use it in GitHub Desktop.
Angular How to Check No internet connection And Cookies Disabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.onLine --> Check for Internet connection | |
navigator.cookieEnabled --> Check for Cookies Enabled. | |
if (navigator.onLine == false || navigator.cookieEnabled == false) { | |
this._router.navigate(['/offline']); // create a new page named like "offline" & redirect to that page | |
this.util.isOffline = true; // for custom use to activate route | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment