Adding a script before the closing body tag without access

Viewed 44

I am using a third party tool to create an app, although I have access to the head section, I don't have access to the closing body tag.

I need to add a script to the closing body tag, is there a way to do this using javascript for instance.

I tried using

<script src="demo_defer.js" defer></script>

But that doesn't work.

2 Answers

There are 2 things that you can do: -

  1. First of all, check whether you have added the correct path to the 'demo_defer.js' file.

  2. If you have mentioned the correct path to the file, then you can try the following: -

<head>  
    <script src="path_to_demo_defer.js" defer></script>
</head>

First of all, check whether you have added the correct path to the 'demo_defer.js' file.

If you have mentioned the correct path to the file, then you can try the following: -

<head>  
    <script src="demo_defer.js" defer></script> 
</head>
Related