the HTML script tag and non-JS content - Firefox

后端 未结 3 599
青春惊慌失措
青春惊慌失措 2021-01-06 17:09

It appears this code will request the file in Chrome and IE but not in Firefox.



        
3条回答
  •  半阙折子戏
    2021-01-06 17:44

    Is there a some spec that says browsers should only process JavaScript related mime-types?

    See the type attribute:

    This attribute gives an advisory hint as to the content type of the content available at the link target address. It allows user agents to opt to use a fallback mechanism rather than fetch the content if they are advised that they will get content in a content type they do not support.

    If you want to fetch arbitrary content for use in a script, use XMLHttpRequest.

提交回复
热议问题