Saturday 13 May 2017

How to correctly identify external references in a html string?

A html page could load external files (eg, .css, .js, .json, .csv). For example,

<head>
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
</head>

The above lines are static references and loading, I don't know if we could build an external link dynamically (in run-time), or load an external link dynamically (in run-time, eg, in a condition branch).

What I am interested is to identify all these static and dynamic external files in a html string. It will be useful, eg, dynamically add a version to files to prevent them from being cached.

Does anyone have an accurate way to do so? Any client-side or server-side solutions are welcome.



via SoftTimur

No comments:

Post a Comment