Error: This action is not supported by the object in Internet Explorer 11

I have encountered a strange issue where my code works perfectly in Google Chrome, but throws an error in Internet Explorer specifically at the line mentioned below. Does anyone have any suggestions on what changes need to be made for it to work in IE?

var file = new File([JSON.stringify($localStorage)], "somefile.txt", {type: "text/plain;charset=utf-8"});

Answer №1

Link to original response

Summarizing the provided link, it is mentioned that Internet Explorer 11 does not have support for the new File() constructor. Therefore, one must resort to using a blob instead. Below is a simple example:

var myData = ["Hi", "There", "456", "Greetings"];
var b = new Blob([JSON.stringify(myData)], {type: "text/plain;charset=utf-8"});
window.navigator.msSaveBlob(b, "DownloadedFile.txt");

This code snippet should prompt the user for a download action.

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

Show data on television

My workplace recently acquired a few TVs that we plan to use as display screens for project-related information such as schedules, TO DO lists from web apps like Buildertrend, and accounting crystal reports in the form of dashboards or direct crystal repor ...

Having issues with $emitting not working for parent-child components in Vue. Any ideas on what I might be doing incorrectly?

I have a login component that I need to call in the main vue component of App.vue. Within the login vue, when I click on any button, it should activate another vue component using Vue.js router to replace the login page. I have searched for solutions but h ...

Load content within the DIV container

I need help finding code that can use JQuery to load a page into a DIV element. Essentially, I want to load displaycatch.php into a specific DIV <div id="results">Content for id "results" Goes Here</div> Furthermore, I would like to add a ...

How can I retrieve the height of a dynamically generated div in Angular and pass it to a sibling component?

My setup consists of a single parent component and 2 child components structured as follows: Parent-component.html <child-component-1 [id]="id"></child-component-1> <child-component-2></child-component-2> The child-compo ...

Error occurred when sending form data while uploading a file

Upon trying to upload a file using the formData.append(key, value);, an error message is displayed in the value section: The argument of type 'unknown' cannot be assigned to a parameter of type 'string | Blob'. Type '{}' is ...

Finding queries in MongoDB collections seem to be stalling

I have been attempting to create a search query to locate a user by their username. Here is the code: userRouter.get('/user/:user_username', function(req, res) { console.log("GET request to '/user/" + req.params.user_username + "'"); ...

Turning HTML into an image with the power of JavaScript

Utilizing html2canvas to convert a div into an image, everything is functioning properly except for the Google font effect. The image shows how it eliminates the effect from the text. https://i.stack.imgur.com/k0Ln9.png Here is the code that I am using f ...

Sort array in ReactJS using JSON data fetched from a URL

There is a URL where I have stored some data, such as: [ {"id":1,"first_name":"add","last_name":"add"}, {"id":2,"first_name":"sfdf","last_name":"aad"} ...

What is the best way to manage separate templates for the client and admin sides of an angular-full

Is it possible to use different types of templates for the client side and admin side in angular-fullstack? Could you please provide guidance on how to accomplish this? My current routes are as follows: www.sitename.com - main site with theme1 () www.si ...

Hide the external div if the tab is active in Angular Bootstrap

How can I determine if a specific tab is active and then hide a div outside all tabs when it is active? Plunker: https://plnkr.co/edit/b9O9S7JxxgzhQKcKONkn?p=preview <div class="border"> Conceal me when Tab #3 is active. </div> < ...

ESLint has detected an unexpected use of an underscore in the variable name "__place". Avoid using dangling underscores in variable names to follow best coding practices

I received the JSON response shown below. To validate the _place, I used responseData.search[0].edges[0].node._place { "data": { "search": [ { "_place": "SearchResultItemConnection", "edges": [ { "cursor": ...

text/x-handlebars always missing in action

I'm currently working on my first app and I'm facing an issue with displaying handlebars scripts in the browser. Below is the HTML code: <!doctype html> <html> <head> <title>Random Presents</title> ...

Inserting a new row into a particular table

I am working on a project where I have a table that displays different exercises. My goal is to allow users to add a new row for each exercise individually. Currently, the snippet below shows how I have implemented this: <!DOC ...

The view in my node is rendering a different ejs view, and I have verified that the path

Currently, I am using the render method for a view in EJS. The path is correct but the view in the route is an old one that I used for testing purposes. This is my server.js code: https://i.sstatic.net/Xl1Ct.png Here is my route: https://i.sstatic.net/ ...

Manipulating global state properties within a reducer function in React: How to do it efficiently

I am looking to implement a single loader (backdrop and spinner) within my app component that can be displayed based on the value of a property in the Redux state called showLoader. This loader should be accessible throughout my entire React application. T ...

Dynamically updating the scroll area in Ionic using real-time data

Hello, I am currently working on an Ionic project and have created a code pen for it. At the moment, the code pen just displays an image with two buttons for zooming in and out. However, I have encountered an issue. When I click on zoom in and scroll to ...

Best practices for declaring variables in ReactJS

I need help understanding how to declare a variable in a React JS class so that it is accessible in different functions. Here is my code snippet: class MyContainer extends Component { constructor(props) { super(props); this.testVariable ...

The Protractor tests run smoothly on Chrome and Firefox but encounter issues when running on PhantomJS

I've successfully created several E2E tests using Protractor with Firefox and Chrome, but I'm encountering issues when trying to run them with PhantomJS on our CI server. The error message I'm receiving is: UnknownError: Error communicating ...

Injecting services into AngularJS directives is a common practice

I recently started using angularjs and encountered an issue while including a service into a directive, resulting in the Error: [$injector:modulerr]. Below is my file structure and the actual files used: Directive :- video_course.js videoCourseApp.direc ...

What is the best way to continuously compare two date variables every minute using Javascript?

In my script, I have two date variables - one representing the current time and the other two minutes later. My goal is to compare both values every minute and trigger a function when the current time is greater than or equal to the latter time. Unfortun ...