martin
martin

Reputation: 1787

HTML: multiple files in src of script tag

Today I found HTML tag SCRIPT with two files in src seperated by pipe char.

What does it mean? Never before have I seen it.

It loads both files? Or only a.js, if a.js not exist then load b.js?

<script src="a.js|b.js" type="text/javascript" charset="utf-8"></script>

Upvotes: 0

Views: 1652

Answers (2)

Quentin
Quentin

Reputation: 944112

It means nothing special as far as the client is concerned. The URL is a.js|b.js and that is what the browser asks the server for.

It is possible that the particular server that is hosting that HTML document has a server side program which will interpret that URL to mean "Concatenate the contents of the files a.js and b.js and send the result back as the HTTP resource", but that's completely transparent to the client.

Upvotes: 0

sdabet
sdabet

Reputation: 18670

The W3C specification does not mention such | special character, it says that

this attribute specifies the location of an external script.

As a consequence the content of this attribute should be interpreted by any browser as the URI of a single external script to be loaded.

In your example a.js|b.js will be interpreted as a single filename, and not two separate scripts.

Upvotes: 1

Related Questions