We are trying to make the angular 7 application work only in few specific list of browsers. And if the browser not falls in the list configured, we just need to show a simple HTML page, and stop any further processing. The following code has been added for this, and its working fine in those browsers (eg: IE 8) in which Angular is not supported by default. But when trying to replicate the same behaviour in modern browser (eg:Latest version of Opera) its showing the error page(browser not supported) and proceeding to the application Login page. How to prevent this. (we dont want the navigation to login page in these specific set of browsers). The below code goes in Index.html
<script>
//showing relevant code section only
BrowserDetect.init();
//supported browser with old version
if (BrowserDetect.browser == "MS Edge" && BrowserDetect.version < 13 ||
BrowserDetect.browser == "Chrome" && BrowserDetect.version < 45 ||
BrowserDetect.browser == "Safari" && BrowserDetect.version < 10 ||
BrowserDetect.browser == "Firefox" && BrowserDetect.version < 53
) {
document.write("HTML for old version browsers go here");
}
//unsupported browser eg:Opera, IE etc..
else if (BrowserDetect.browser !== "MS Edge" && BrowserDetect.browser !== "Firefox"
&& BrowserDetect.browser !== "Chrome" && BrowserDetect.browser !== "Safari") {
document.write("HTML for unsupported browser goes here");
**//issue: In latest version of Opera Browser the unsupported HTML is shown and the application is getting navigated to the Login screen. How to prevent further angular application execution from this line**
}
</script>