I need to handle the exception, so that I can show a proper message to user.
Handle/Catch Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
I need to do this because I'm building a demo React application which uses an insecure Websocket(not my own). And I need to deploy it on a GitHub page.
Since GitHub page will enforce HTTPS by default, the app cannot access the insecure Websocket unless the user clicks on 'Load Unsafe Script' button in the browser.
Hence I would like to catch the above exception to show an appropriate message only when required.
Comments
Post a Comment