Embed a web widget (?) In a web page

We have clients who create small intranet applications on the servers that we provide them. The servers also host the various (based on Windows / .net) systems that we created.

We need to provide our customers with a single code that will allow them to embed functionality on their web pages. Similar to how Google Ads works when they are embedded in a site. The slight difference is that we will need to be updated every 5 seconds or so. We will create several of these "widgets" to place them on our pages.

Our entire development is in .Net, so I would prefer options in relation, but I am open to anything.

Early research points to IFrames, perhaps with Ajax or JavaScript, jQuery and webservice, or with IHttpHandler, which returns HTML via "Document.Write" (for example) .

Recommendations

+4
source share
1 answer

Simply put, iframes are simple because they eliminate any potential conflicts with the client website. This is vital if you also do not manage the clientโ€™s website so that you control the environment in which you insert your widget.

Otherwise, situations when you embed your widget code directly on the clientโ€™s website (without using an iframe) can cause a conflict with the HTML, CSS or Javascript client. You can write your widget code so that it does not conflict, but as a rule, you cannot depend on the code for your web page. All that is required is something poorly written on your client site to cause problems with the built-in widgets. CSS is a simple example. Say your client had something stupid in the stylesheet, for example:

div { background-color: red; } 

... if you did not specify a background property with a more specific selector for all divs used in your widget, now they are red.

I think the best way to make widgets is to provide your clients with a single external script link that passes the client ID to the script URL. Your script starts with document.write () - with Iframe - so you have future control over all aspects of your widget (including iframe) without any changes from your clients.

+1
source

All Articles