Skip to content

Instantly share code, notes, and snippets.

@msaxena25
Last active June 13, 2018 10:59
Show Gist options
  • Save msaxena25/9fac1aa729ff5b6f1f93a2441228fa36 to your computer and use it in GitHub Desktop.
Save msaxena25/9fac1aa729ff5b6f1f93a2441228fa36 to your computer and use it in GitHub Desktop.
Angular How to Check No internet connection And Cookies Disabled
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