How to include HTML code inline into web page from a CDN source (similar to a #include in C)

RobertS 1 Reputation point
2022-09-19T00:32:27.02+00:00

Not sure I am asking this in the right forum, but here goes.

I am creating a web page on a medium sized embedded CPU (about 1/2M RAM). When creating the web page that will be used by the embedded web server, I reach about 90+% of my available RAM.

I have already offloaded all the 3rd party libraries to Azure CDN - jQuery, Custom Graphing Libraries etc.

About 75% of my HTML code is constant, and 25% is created at runtime (depending on the setup of the device).

I would like to know if I can save the 75% unchanging code in a CDN, and the similar to C - #include it into my html page from the cdn. (the code may contain constrant scripts, HTML tables etc, and the included code would not be aligned. Another words, it would have to work like a C #include - just pasted inline into the web page.

Azure Content Delivery Network
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 54,466 Reputation points
    2022-09-19T02:20:17.383+00:00

    Hi @Robert Salasidis

    I'm not sure if I am answering your question correctly, but here it goes.

    I don't see why you can't offload all CSS/JS (anything front-end to CDN). Front-end styling/scripts that are static don't need to be hosted on your device/server and saves processing (read) on the device/server. Processing should be reserved for functions on the server such as database and back-end processing (in your case, the sensors).

    Your graphs will most likely be styled with css/js and that can come from the CDN.

    Hope this helps.

    -----------------------

    If this is helpful please accept answer.