Search code examples
htmlimporthtml-imports

Does the browser de-duplicate HTML imports if the unresolved paths are different?


If I have two HTML imports of the same file, but the unresolved paths are different, will the browser figure out that the imports are from the same location or will it import the element twice?

For example:

<!--If I am in a random folder: -->
<link rel="import" href="/bower_components/paper-ripple/paper-ripple.html">

<!-- If I am at the root: -->
<link rel="import" href="bower_components/paper-ripple/paper-ripple.html">

<!-- If I am in a sub folder in bower_components: -->
<link rel="import" href="../paper-ripple/paper-ripple.html">

Solution

  • Yes, it will work.

    You can observe it by means of the F12 / DevTools in your favorite browser.