Forum Academy Marketplace Showcase Pricing Features

How do I load plugin scripts in <body>?

I’m building a plugin which will include a JavaScript library and it needs to load in the <body>, for example:

<script src=""></script>
    // code here...

In the plugin editor, I only see a way to load this in the <header> through Shared > HTML Header:

either in the header define <body></body> tags around it or do the same inside the div tags.

1 Like

At stated here, it’s not conventional to use multiple <body> tags.

…or do the same inside the div tags.

Could you elaborate on how to approach it this way?

just like the plugin builder is not conventional. I invite you to turn this code into a html file and open it in all of your browsers. you will find that even good old Microsoft Word displays the mark up correctly.

<h1>Hello World</h1>
  <title>Page Title</title>

<p>The content of the body element is displayed in the browser window.</p>
<p>The content of the title element is displayed in the browser tab, in favorites and in search engine results.</p>


For your case above in the header section, place

<script src=""></script>

inside the head section or depending on what your building maybe something like,

var div;
div = $('<div><body><script src=""></script></body></div>');

apply logic to your plugin testing and most conventional methods will be soft guidelines.