Jump to content

Problem with Javascript order


Mouflit

Recommended Posts

Hi

 

I'm using PrestaShop™ 1.6.0.5.

 

So I want to use browser-sync node module to automatically reload my page after change so I need to add this code at the end: (in footer.tpl)

{literal}
<script src='//192.168.1.99:3000/socket.io/socket.io.js'></script>
<script>var ___socket___ = io.connect('http://192.168.1.99:3000');</script>
<script src='//192.168.1.99:3001/client/browser-sync-client.0.7.3.js'></script>
{/literal}

the problem is, after reload the code looks like this in the source:

<script type="text/javascript" src="http://192.168.1.99:3000/socket.io/socket.io.js"></script>
<script type="text/javascript" src="http://192.168.1.99:3001/client/browser-sync-client.0.7.3.js"></script>
<script type="text/javascript">
var ___socket___ = io.connect('http://192.168.1.99:3000');
</script>

see the problem ? ___socket___ variable is declared at the end and the second line needs it. Why prestashop is doing that and how can I prevent this behavior ? Thank you  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...