Kornel William
Kornel William

Reputation: 77

Loading script with wrong media type

What will happen if I load script tag with incorrect type. For example,

<script type="image/png" src="index.html" />

Will I receive content of index.html page? Will I get any error from browser? My main concern is can I use such incorrect tag in dynamic way to communicate with index.html page?

Upvotes: 0

Views: 178

Answers (2)

manny
manny

Reputation: 1948

It is invalid syntax, you are merging three different type of properties together.

  1. starting script tag will look always script type should be any of the scripting language like javascript or vbscript or etc..
  2. according to your type script you need to say your script location in src=""

Neither this will work nor throw error.

Upvotes: 0

Alohci
Alohci

Reputation: 83006

According to HTML5, behaviour is browser dependent, because the list of supported script mime types is browser dependent. But it is highly unlikely that any browser would consider image/png as a supported scripting language, in which case, HTML5 requires that the file is not fetched.

See http://dev.w3.org/html5/spec/scripting-1.html#prepare-a-script with particular reference to steps 7 and 14.

Upvotes: 1

Related Questions