Scripting issues detected in Safari and Microsoft Edge browsers

I recently finished developing an AngularJs Application that works flawlessly on Google Chrome and Mozilla Firefox. However, upon testing it on Safari and IE-11, I encountered errors in the console.

One particular piece of code that causes issues is used multiple times to open a bootstrap modal:

$modal.open({
    templateUrl: "dummyTemplate.html",
    controller: "DummyControllerName",
    controllerAs: "vm",
    windowClass: 'popupModal',
    size: 'sm',
    resolve: {
        dummyData: function(){ return object; }
    }
}).result.then(data => { 

});

https://i.sstatic.net/0NaiS.jpg

Another problematic code snippet involves using $rootScope.$on to display toast messages:

$rootScope.$on("toastIt", (e, d) => { // <- This line triggers an error in IE and Safari
    toaster.pop(d.type || 'success', d.title, d.text);
});

The issue stems from EcmaScript support limitations in Internet Explorer and Safari. Can anyone suggest the best approach to address this problem and ensure my AngularJs Application can run smoothly on all browsers?

If modifying the code structure is the only solution, it would require changes in numerous places and consume a significant amount of time. Are there any alternative methods to resolve this issue efficiently?

Answer №1

It seems like you're running into an issue because of the arrow function usage in IE11. Unfortunately, IE11 doesn't have support for arrow functions and some other ES2015+ features. (But any recent version of Firefox does.)

To fix this, you'll need to transpile your code from ES2015+ to ES5 using a tool like Babel. This transpilation process should be integrated into your build process before deploying the code that is compatible with older browsers.

Alternatively, make sure to only use features that are supported by all your target browsers to avoid compatibility issues. For example, avoid using arrow functions if your target includes IE11.

Answer №2

It appears that there is a missing closing } in your resolve line. Here is the section of code where the issue lies:

$modal.open({
  ...
  resolve: {
    smudgedOut: function(){ return response.data
  }
})

The correct version should look like this:

$modal.open({
  ...
  resolve: {
    smudgedOut: function() { return response.data; }
  }
})

According to the information provided in the chrome dev tools, this seems to be the problem.

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

Is it possible to make an AJAX request even when the server file (such as PHP) is missing?

While working on the Sharetronix script, I encountered something unusual. In the console, I noticed that a network request was being sent to the following address: http://localhost/ajax/postform-submit/ajaxtp:xml/r:0 However, I couldn't locate any f ...

Set a default value for a FormControl within react-bootstrap

When working with my email address, I utilized the <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="44362125273069262b2b30373036253404746a76706a71">[email protected]</a>. In order to specify the initial value chosen ...

Database storage of image tags on websites, similar to functionality found on social media platforms such as Facebook

Looking for an image tagging solution for websites that can save tag data directly to a database instead of a local file? I've checked out , but it doesn't support database integration in the current version. Ideally, I need a solution that is co ...

What is the best way to redirect to the login page using the PUT method in express.js when the user is not authenticated?

I am encountering an issue where I need to update a database from an AngularJS page using the $http.put method. However, if the session expires, it displays errors on the server. When the put method is triggered, it goes to this route: PUT /api/categorie ...

"Using a triangular background shape in JavaScript instead of a traditional circular

I want to add a unique effect to my site inspired by the AnimatedHeaderBackgrounds demo available at this link. My twist on this effect involves using upward-moving triangles instead of circles. I've explored various resources, including Stack Overfl ...

Javascript provides the ability to return a JSON object containing a specific function name

Currently, I am in the process of mastering AngularJS, and recently came across this code snippet: .factory('cribs',function(){ var data = [{ name: "jack", last: 'doe' },{ name: 'hazel&apos ...

Ensuring the node array is easily accessible within the view

I am currently working on building a simple messaging system using express/nodejs. Although I have successfully implemented the feature to send messages to all users, I now want to enable users to have private 1-to-1 conversations. My aim is straightforwa ...

The property '$$nextSibling' cannot be read because it is null

I encountered an error in my program when attempting to destroy my own scopes. The issue seems to be stemming from a while loop within Angular: if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { while(curre ...

What is the best way to synchronize the state of a single React component across various pages?

I am currently working on a React Component that includes a toggle feature (on or off) with the state being managed by the component's own state (this.state). My dilemma is ensuring that this state remains when the user navigates from one page to ano ...

The Discord.js bot is currently experiencing an UnhandledPromiseRejectionWarning: TypeError due to the inability to access the property 'user' which is showing as undefined

I'm currently navigating the complexities of altering my Discord bot's status. I find myself in a state of confusion as I attempt to grasp the concept of promises, which seems to be playing a role in my struggle. Additionally, Discord's read ...

Obtaining a string from a regular expression does not function as anticipated

Currently, I am in the midst of a project that requires me to identify specific HTML tags and replace them with others. To accomplish this task, I am utilizing JavaScript, and the code snippet looks like this: // html to update html = '<div cla ...

Is it acceptable to incorporate Node.js modules for utilization in Next.js?

Here's a funny question for you. I am trying to generate UUID in my Next.js project without adding any unnecessary packages. So, I decided to import crypto in my component like this: import crypto from 'crypto'; After importing it, I used i ...

Showcasing a Collection of Dropdown Options for All Angular Material Icons in Angular Versions 2 and Above

I'm currently developing an Angular 10 application that utilizes Angular Material Icons. I am in search of a method to dynamically showcase a dropdown menu containing all the available Material Icons. My attempt to programmatically retrieve the icon ...

What is the best way to display the elements of an array within an HTML div element?

I've been trying to display the contents of an array in a div container on my HTML file, but I'm stuck. Here's what I currently have: function printArray() { var $container = $('.container'); $container.html(''); ...

Verify whether a web application is equipped with React, Angular, or Vue

Is there an easy way to identify the client-side libraries used by an application if they are minified or compressed? While examining all the JavaScript sent from the server to the client, it can be challenging to determine if one of the top three popular ...

Convert form data into a JSON object utilizing JQuery and taking into account nested JSON objects

Currently, I am facing an issue while extracting data for submission using the jQuery `serializeArray()` function. This function works efficiently by providing an array of { name: value } objects, where the name corresponds to the elements in the form. How ...

Is it possible to verify if a bearer token has expired within an Angular application?

Is there a secure and efficient way to determine when a bearer token has expired in my Angular application? This is the issue I am facing: If I keep the app open in my browser, someone could potentially access sensitive information on my screen since I am ...

Issues with functionality of JavaScript calculator in HTML forms

Currently, I am working on creating a basic perimeter calculator specifically designed for a projector screen. This code is intended to take the response from a radio button input and the diagonal length in order to accurately calculate the perimeter base ...

Encountering an error while trying to run the command "npm run start" due to an issue of "EMFILE

After running npm update, my project start broke. When I try to use npm run start, it returns the following error: 10% building 0/1 entries 0/0 dependencies 0/0 modulesnode:internal/errors:484 ErrorCaptureStackTrace(err); ^ Error: EMFILE: too many ...

What is the method for getting js_xlsx to include all empty headers while saving the file?

In the midst of developing a Meteor App, I've incorporated the Node.js package known as "js_xlsx" from "SheetJS", produced by "SheetJSDev". This tool enables me to convert an Excel sheet uploaded into JSON on the backend. The intention is to store thi ...