Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-24T00:26:27.393Z
Answers.Text: Inside a {% js %} block, could you pull in an external script and run it?
Answers.UserDisplayName: ponies
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-22T10:53:37.337Z
Answers.LastActivityDate: 2020-12-22T10:53:37.337Z
Answers.UserDisplayName: ZealousWeb
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-03T09:07:53.237Z
Comments.Text: I may be missing something here, but you probably just want to use the `<script>` tag?
Comments.UserDisplayName: dmatthams
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-03T19:12:55.933Z
Comments.Text: 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.
Comments.UserDisplayName: ponies
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-04T09:33:00.090Z
Comments.Text: 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.
Comments.UserDisplayName: dmatthams
Tags: <craft3><templating><javascript>
Title: How to include external JavaScript in place?
ThreadText: # 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 `<script src="">` tag as it's a combination of the html and twig. So it will load your external javascript files.
  
  Also you can use the inline javascript or javascript file using this tag `{% js %}` like below.
  
  ```
  {# Use for JS file #}
  {% js "/assets/js/script.js" %}
  
  {# Use as a JS code block #}
  {% js %}
  
  console.log("hello World");    
  
  {% endjs %}
  
  ```
  
  > **Comments:**
  > **username_0**: Inside a {% js %} block, could you pull in an external script and run it?  
  
  ---
  
  