Reputation: 13
I have a need to display our application widget within a third-party website (think things like GetSatisfaction, UserVoice and other feedback widgets that people use).
What is the safest and most reliable way to do this? I can think of some criteria and issues already:
<script scr='mywebsite.com/widget.aspx' ...>
as the sole thing to give to my customer.Ideally, is there a well established piece of code I can use to get started?
Upvotes: 1
Views: 1520
Reputation: 385
Probably the easiest way to isolate your widget from all of the customer's JS and CSS code is to embed it in an IFRAME.
If necessary, you can provide a script that will inject the IFRAME into the document. You can keep your variables isolated from the global namespace by encasing everything like so:
(function() {
//inject iframe into document.
})();
Upvotes: 1