src attribute. Like other HTML tags that have the
src attribute, the
<script> tag supports data URIs.
As is the case with the <link> tag, there is no reason to use data URI to embed scripts, because you can embed scripts as source code. It is easier, faster and smaller. Below I provide three examples that do the same thing, but the data URI is just for fun.
Example #1 (load script from external URL):
Example #2 (embed script using data URI):
Example #3 (embed script as source code):
<script>alert('Welcome to base64.guru!');</script>