0

I am developing an embeddable widget using an iframe that can be used by injecting the script tag.

In the script tag, I have a set of code that dynamically creates an IFRAME and injects it into the user site. How to use script tag within this Iframe to load third-party javascript like Jquery?

const $_Iframe = document.createElement('iframe');

If I use the below method, It is getting loaded in the parent DOM (user html)

var s1 = document.createElement("script");
    s1.async = true;
    s1.src = url;
    var s2 = document.getElementsByTagName("head")[0];
    s2.parentNode.insertBefore(s1, s2);
tadain
  • 138
  • 10

0 Answers0