<p>In your template you can use the <code>&lt;script src=&quot;&quot;&gt;</code> tag as it's a combination of the html and twig. So it will load your external javascript files.</p>
<p>Also you can use the inline javascript or javascript file using this tag <code>{% js %}</code> like below.</p>
<pre><code>{# Use for JS file #}
{% js &quot;/assets/js/script.js&quot; %}

{# Use as a JS code block #}
{% js %}

console.log(&quot;hello World&quot;);    

{% endjs %}
</code></pre>

CC BY-SA 4.0
2020-12-24T00:26:27.393Z
Inside a {% js %} block, could you pull in an external script and run it?
ponies
CC BY-SA 4.0
2020-12-22T10:53:37.337Z
2020-12-22T10:53:37.337Z
ZealousWeb
<p>We include an external script from a vendor and the URL doesn't end in .js. It returns JavaScript that creates a widget in place. I was able to fake it out by adding a '&amp;js=.js' parameter but it still rendered with the other scripts.</p>
<p>Is there an option for {% js %} to render in place? A {% js at right-here %}?</p>

CC BY-SA 4.0
2020-12-03T09:07:53.237Z
I may be missing something here, but you probably just want to use the `<script>` tag?
dmatthams
CC BY-SA 4.0
2020-12-03T19:12:55.933Z
I may be too. That's the only thing I've got working so far, but I'm not sure if there's a standard way to do it.
ponies
CC BY-SA 4.0
2020-12-04T09:33:00.090Z
The {% js %} tag can only inject javascript at the end or beginning of the page so it's fine to use the <script> tag if you need something in place.
dmatthams
<craft3><templating><javascript>
How to include external JavaScript in place?
# How to include external JavaScript in place?

(Asked by: username_0 on 2020-12-03)

We include an external script from a vendor and the URL doesn't end in .js. It returns JavaScript that creates a widget in place. I was able to fake it out by adding a '&js=.js' parameter but it still rendered with the other scripts.

Is there an option for {% js %} to render in place? A {% js at right-here %}?

**Tags:** craft3, templating, javascript
> **Comments:**
> **username_1**: I may be missing something here, but you probably just want to use the `<script>` tag?  
> **username_0**: I may be too. That's the only thing I've got working so far, but I'm not sure if there's a standard way to do it.  
> **username_1**: The {% js %} tag can only inject javascript at the end or beginning of the page so it's fine to use the <script> tag if you need something in place.  

---

## 1 answers

### Answer by username_2 on 2020-12-22. Score: 1

In your template you can use the

> **Comments:**
> **username_0**: Inside a {% js %} block, could you pull in an external script and run it?  

---

