'identifying stack trace error based on condition

I am trying to show a different message when the users are getting local storage error. For both android and ios users who access the site. So the below are the two different error messages we are getting when html5 storage is turned off.

SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

SecurityError: The operation is insecure.

So how can i identify that the security error is only related to html5 (local storage) so that i can show user a message. So apart from this local storage error it should be normal. Is there any status code or something which i can get the difference



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source