My Next.js application is experiencing issues on Internet Explorer.
When accessed using IE, the app displays a blank screen and generates syntax errors in the console.
Although it's understandable given that IE is being phased out, I want to prevent the problematic code from executing specifically for this browser.
Referencing this solution, I can identify if the user is using IE:
if (window.document.documentMode) {
// IE detected
document.write('IE is not supported. Please switch to a more modern browser!')
}
By implementing the code snippet above, users who use IE will be informed about why the site isn't functioning properly instead of encountering a blank screen.
However, there are two interrogations regarding this approach:
- Where should the aforementioned code be placed within Next.js?
- Is it feasible to terminate the application after running this code, or is there an alternative approach?
Any assistance on this matter would be highly appreciated.