Strategies for reliably causing IE 10&11 to crash? Simulating the phenomenon of "Internet Explorer abruptly closing and reopening the tab"

Here's an interesting query. Is there a method to consistently trigger this error in Internet Explorer 10 & 11 using Javascript, CSS or HTML?

An issue with this website is forcing Internet Explorer to close and reopen the tab.

I'm not trying to create a harmful website, I just need to replicate a scenario where IE crashes for testing purposes.

Are there any known bugs that could cause this error to occur across all versions of IE?

Answer №1

Short version: @CodingIntrigue's suggestion fixed the issue I was having in Internet Explorer 11

If you encounter a memory leak problem, you can incorporate this code snippet into your HTML logic:

<script type="text/javascript">
    while(true) {}    //stop messing around and crash this window to trigger IE11's default behavior of opening a new one
</script>

Note: My browser window was already struggling with memory issues at this point, making it easy to replicate the error consistently. However, on less complex pages, IE11 may not crash as quickly or reliably.

I was facing a memory leak in IE11 with my JavaScript React web app. To resolve it, I attempted to use window.open for a fresh memory start and planned to close the current window using window.close due to IE11-related memory leaks, following the guidelines mentioned here.

The challenge arose when I couldn't execute window.open within the memory full error callback. The memory constraints prevented it. However, by forcing IE11 to follow its default error flow of reopening the tab, I achieved a similar result. The upcoming code illustrates how I implemented the while loop strategy in this scenario, incorporating unhandled promises handling as well.

window.addEventListener('error', function(e) {                     //respond to errors

    var errorMessage = e && e.message ? e.message.toString() : '',
        errorType = e && e.type ? e.type.toString() : '',
        targetNodeName = e && e.target && e.target.nodeName ? 
        e.target.nodeName.toString().toUpperCase() : '';

    //Additional logic added here based on `errorMessage` and `errorType`
    while(true) {}    //stop messing around and crash this window to open a new one via IE11 default behavior

})


window.addEventListener('unhandledrejection', function(e) {
    //Note - This callback has not been invoked yet
    var errorMessage = e && e.message ? e.message : '';
    console.log('in unhandledrejection callback listener: ' + errorMessage, e);
}, true);       //`, true` sets `useCapture` Boolean

The following snippet demonstrates how you could attempt to fill up the memory (although personally, I didn't manage to make it work due to existing memory limitations). Reference taken from @Jaroslav Tulach's answer. You may need to adjust it further according to your requirements.

function gc(max) {
    var arr = [];
    for (var i = 0; i < max; i++) {
      arr.push(i);
    }
    return arr.length;
}
//Attempt to prompt IE11 garbage collector to run
for (var i = 0; i < 10; i++) {                  // repeat until sufficient:
    gc(Math.pow(2, i));
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Jasmine was curious about how to declare a loop of 'its' rather than a loop of 'expects' when testing an Angular factory

In the task of testing an angular factory, here is the code that needs to be tested: var myApp = angular.module('myApp', []); myApp.factory('factoryTest',function(){ return [ {number: 1, name: 'one'}, {nu ...

Assistance needed with user relationships

I'm having trouble figuring out how to set up my SQL tables for managing user friendship connections. I have a User table where all users are stored, and I want them to be able to connect with each other as friends through a "Friends" table. Essentia ...

In what way can I fill out my search fields using the criteria included in the URL?

In the process of developing an asp.net web application, I have implemented a code snippet to construct a section for search fields. This code builds URL parameters based on user input: <script type="text/javascript> $(document).ready(function(){ ...

Can you share tips for passing a variable from a post request to a function that accepts parameters as a string or an array of strings in Node.js?

I am struggling to insert the variable named query into the end of the prompt. I attempted to use template literals but it was unsuccessful. (async () => { const gbtResponse = await openai.createCompletion({ model: "text-davinci-002", prompt ...

The navigation bar refuses to budge towards the right side

I am having an issue with my navbar alignment. I have set the div as shown, but the navbar is still staying on the left side instead of moving to the right. <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" h ...

Tips for creating a hover effect on an icon within a CSS grid

I've just started learning to code and wanted to create a component for previewing/displaying a project I'm working on. I've been attempting to add a hover effect to my links such as the GitHubIcon and LaunchIcon, but so far, it's not w ...

Retrieve JSON data within a service and provide it to a component

I am currently facing an issue with loading data from a JSON file into my component using a service. The data is successfully loaded in the service, as confirmed by the console log; however, when trying to access the data in the component, it does not disp ...

jQuery random generator for creating two-dimensional arrays

Why do all rows always have the same numbers? They should be populated with random numbers. Also, how can I fix this issue? I remember seeing a solution here before but now I can't seem to locate it. var mapSizex = 5; var mapSizey = 6; var mapArray ...

jQuery organizes information within tables

Encountering a bug while trying to manage table data using various languages. Below is the current setup: HTML: <input type="button" id="add_language" value="Add Language" /> <table> <tbody id="languages"> ...

When attempting to open a native app using JavaScript, it fails to function properly. However, the same code successfully opens the

These questions revolve around a web application developed in React that will be accessed through smartphones' browsers. I conduct testing on an iPhone using both Safari and Chrome. One of the steps involves opening a native authentication app. As pe ...

Tips for managing credentials and cookies across multiple websites

I have a vision of creating a website similar to Stack Overflow, complete with individual blog pages and applications for each member, all using MVC 3. I want to combine various features from different websites into one cohesive platform. How can I achie ...

Problem with Ajax-appended form element not functioning -

I'm struggling with this ajax form method code $.ajax({ type: "GET", url: "/MainPage/GetAllRecords", dataType: "json", contentType: "application/json; charset=utf-8", success: function (data ...

Retrieving the date from a webpage

Looking to extract the date from a webpage, like so: <div class="update" style="width: 1037px;"> Last update: <span id="last_update">6.30.2011</span> </div> Interested in fetching the date (6.30.2011, as shown above). Usin ...

What is the best method for accessing OpenWeatherMap details via JSON?

I am facing a challenge in JavaScript as I attempt to create a program that fetches weather information from OpenWeatherMap using JSON. My experience with JSON is limited, but I believe I have a grasp of the underlying concepts. Despite this, when I trigge ...

Can a website be designed to mimic the style of the current operating system?

Is there a way to apply CSS styling to web site elements, such as buttons, that mimics the appearance of operating system (Windows, macOS, Linux) button styles? This would allow HTML buttons to automatically adjust their CSS style whenever I switch theme ...

Implementing pagination links to trigger image changes on click

I have a javascript function that swaps the image source when clicked. I am looking to incorporate pagination links in this script. Specifically, I want to include "Previous" and "Next" text links to navigate between images. Can someone help me figure out ...

New post: The vue component that was released lacks CSS (NPM)

For the first time, I am releasing a Vue component on NPM and everything seems to be in order, except for one issue - the CSS is missing. While it functions perfectly when tested locally, after installing the npm package in a test project and importing the ...

Discovering the version of the Javascript library utilized on a website - a step-by-step guide

My quest is to uncover the versions of JavaScript libraries being utilized by popular websites. By using phantomjs.exe, I successfully identified the version information for jquery. However, I am currently at a loss on how to expand this capability to inc ...

Is it possible to achieve a high quality image with a file size less than 2.0MB?

Could someone knowledgeable in website design and development please explain the technique used by Google, Microsoft, and other websites to feature high-resolution photos as backgrounds on their webpages while maintaining a small file size? Here are some ...

Error: SyntaxError - Unexpected token 'if' found. Additionally, ReferenceError - berechnung is not defined

I keep encountering two error messages and I'm not sure where the issue lies: Uncaught SyntaxError: Unexpected token 'if' Uncaught ReferenceError: berechnung is not defined Any idea what might be causing this problem? I've reviewed t ...