1

Say I am wanting to include a third party HTML component in my site...

I know that I can simply include a <script> tag to pull in the component on the client's side; however because I do not trust this component to load in a speedily manner, or to load at all, I am wanting to have it server side render for users so that I am not left with egg on my face when it inevitably fails to load due to some connection issue to the host.

This would be simple if the component was in a final state and would be static, however I know that there is a strong possibility for updates to be rolled out to this component in time, which would leave any static version on my server out of date etc. A problem that would easily be avoided if I'd just use the <script> tag mentioned earlier.

My question is... How do I get around this? Should I be polling the link in the <script> tag I have been given once a day for example just to ensure I have the current version? Should I attempt some sort of subscription service to the link?

physicsboy
  • 111
  • 2

1 Answers1

1

A component that's activated by a script tag will be written in javascript and designed to run in a browser. It will typically work by modifying the DOM, which is how the browser manages the content displayed to the user.

A component that runs server-side will target a server-side runtime, for example PHP or ASP.NET Razor. It will emit html which is then send to the client browser to be displayed.

The two are not easily interchangeable.

If you are worried just about the hosting of the script, the easiest solution is to host a copy of it with your other content. This way you can lock down a version and also ensure it's availability.

Martin K
  • 2,867
  • 6
  • 17