Referencing CDN in Multiple HTML Files
Referencing CDN in Multiple HTML Files
hamlet1964
Posts: 43Questions: 8Answers: 1
I have multiple HTML files that are referencing the same Datatable CDN code. Since the references are updated on occasion, I'd like to have the CDN references sit in 1 HTML file, having all the other HTML head sections referencing that 1 other file, which can then easily be updated.
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.16/af-2.2.2/b-1.5.1/b-colvis-1.5.1/b-flash-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/fc-3.2.4/fh-3.1.3/kt-2.3.2/r-2.2.1/rg-1.0.2/rr-1.2.3/sc-1.4.4/sl-1.2.5/datatables.min.css"/>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.16/af-2.2.2/b-1.5.1/b-colvis-1.5.1/b-flash-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/fc-3.2.4/fh-3.1.3/kt-2.3.2/r-2.2.1/rg-1.0.2/rr-1.2.3/sc-1.4.4/sl-1.2.5/datatables.min.js"></script>
Any idea on how to do this? I'm a beginner, so any help would be much, much appreciated.
thanks.
This discussion has been closed.
Replies
You'd typically use a template. In PHP you could use
include
for example. Other server-side environments have similar options and there is a whole ecosystem of template engines (Smarty, Moustache, Handlebars, Twig, etc).For something like this you'd be best asking on StackOverflow, explicitly stating what server-side programming environment you are using.
Allan
Thanks.
If anyone's interestest, see:
https://stackoverflow.com/questions/50671608/cdn-reference-in-html