any way to access data "loaded" via <script type=plaintext>
Im trying to load some code from an external domian with js. with script tags the browser is (according to firebug) loading the file. This is the code:
$('<script
type="plaintext"src="http://www.google.de">开发者_开发技巧;</sc'+'ript>').appendTo('body');
You cann see after loading the content of the file in this case an html document in firebug but is there any way to access this data for example with js?
No, it's not possible. It would be possible if the src were on the same domain, by using XMLHttpRequest instead.
As a side note, type should be text/plain
.
No, it is not possible to get type
and src
work together in a script!
It is what WHATWG has stated about type when set to anything else than Javascript:
Setting the attribute to any other value means that the script is a data block, which is not processed. None of the script attributes (except type itself) have any effect on data blocks.
Data block is pretty useless without src - object or Blob is MUCH better. Loading something else than Javascript is not possible to access. Mime-types has no practical meaning for except the multityde of mimes to load .js
(and for except Web Extension writers possibly).
精彩评论