Skip to content
Advertisement

Prevent my website from running in Internet Explorer

I don’t want anyone to run my website in Internet Explorer, so I have added the following JavaScript call at the very beginning of the first .js file in my website, the file name is screen.js

screen.js

JavaScript

I have the following .js files in my bundle (ASP.NET MVC syntax):

JavaScript

The above code runs fine in Chrome but IE does not like some of the syntaxt that I have used in my .js file, for example in the screenshot below IE is complaining that there is a syntax error on line 96 of common.js:

enter image description here

And because of this error I don’t get the block IE popup which was supposed to be shown in the earlier call… I am confused because I though I am blocking IE at the very first step… so cannot understand why these Syntax errors are being shown?

Update

I tried the approach suggested by @Nick Olay, see the screenshot below it still shows the loading dots which not supposed to be displayed in IE…

enter image description here

Advertisement

Answer

Thanks to the comment by @epascarello, I managed to solve the issue by detecting the browser on the server side, here is what I have done:

Server side function to detect IE:

JavaScript

And I build the HTML page, based on the above function call:

JavaScript
Advertisement