xoops forums

Mazarin

Just can't stay away
Posted on: 2012/11/20 20:47
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#1

JavaScript only works when logged in

I have a site where I have a JavaScript (jquery.easing, jcarousellite, slider) slider on the front page. The only problem is that it only works for logged in users.

I've tried this theme on a couple of my other test sites (both 2.5.5), and it works for anonymous users in one site, but not on the other site. I just can't figure out what in the setup of the sites (they're on the same server btw) is different between the two so that it works in one but not the other.

Edit: It seems jQuery is not loaded for anonymous users, but I'm not sure why since it looks like it's being called in theme.html:
<!-- Module Header -->
   <{
$xoops_module_header}>
   <
script src="<{$xoops_url}>/libraries/jquery/jquery.js" type="text/javascript"></script>


Any ideas?

Mazarin

Just can't stay away
Posted on: 2012/11/20 21:33
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#2

Re: JavaScript only works when logged in

OK, I fixed it by calling jQuery through this line instead:
<script src="<{$xoops_url}>/browse.php?Frameworks/jquery/jquery.js" type="text/javascript"></script>


However, perhaps someone more knowledgeable than me could explain the proper way of handling this, so that I can avoid any similar problems in the future?