0

I am trying to create a Javascript widget where in the user of the widget will have to add a couple of lines of Javascript to his page which in turn will add an externally hosted javascript to his page. Through this javascript, I'll add HTML code to his page. In this HTML, I'm using Angular Material Library.

I have a few questions:

  1. How should I go about this? Can someone share a link of a related tutorial?
  2. Is it possible to add external stylesheet and script to the widget?
  3. How do I avoid any conflicts with the user's own website global objects?
Faiz
  • 543
  • 1
  • 7
  • 10

1 Answers1

0

You are most likely to create an iframe solution which your Javascript will inject on the page upon rendering.

Name conflicts can be avoided using naming convention for stylesheets, IIFE for scoping.

I think your question seems already answered here: Creating a javascript widget for other sites

Community
  • 1
  • 1
Rikin
  • 5,351
  • 2
  • 15
  • 22