Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9205453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:57:12+00:00 2026-06-17T23:57:12+00:00

I need to add the following script tag to the DOM after a few

  • 0

I need to add the following script tag to the DOM after a few things run on my page:

<script data-main="js/main" src="lib/Require/require.js"></script>

I know that optimally everything will be in my require file, but as of now i need to hotfix this to work in IE.

What i have that is working in FF/Chrome is:

var script = document.createElement('script');
script.setAttribute('data-main', 'js/main');
script.src = 'lib/Require/require.js';
document.getElementsByTagName('script')[0].parentNode.appendChihld(script);

However, IE doesn’t like it when i try to set the attribute 'data-main' and therefore is not working.

How can i get around this and have it add the script element to the dom and have it load the script at the same time?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:57:14+00:00Added an answer on June 17, 2026 at 11:57 pm

    this seems to work fine in IE as well:

    var scriptTag = document.createElement("script");
    scriptTag.type = "text/javascript";
    scriptTag.src = "lib/Require/require.js";
    scriptTag.setAttribute("data-main", "js/main");
    ( document.getElementsByTagName("head")[0] || document.documentElement ).appendChild( scriptTag );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to add fade function in the following script. I need that the
When I need to add Java Script to a single Drupal page, I paste
So what I need to do is add 30 minutes to the following date(Ymdhis);
need to add a 2nd css stylesheet to a page. do i add a
I am dynamically adding tabs to my page using the following script: var tabs
I have the following script working to add odd and even classes to alternating
I need to add 3 lines into a file via a bash script; sed
I need to add the following contents inside a panel in sencha touch2 <a
I want to add the following script in my action script for redirecting to
Following doesn't work. I need to add a , and an input param at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.