# Lightbox2 javascript file behavior different on web server and localhost?

**URL:** <https://www.ruby-forum.com/t/lightbox2-javascript-file-behavior-different-on-web-server-and-localhost/147427>\
**Category:** Rails\
**Created:** [September 1, 2008, 7:02pm UTC](https://www.ruby-forum.com/t/lightbox2-javascript-file-behavior-different-on-web-server-and-localhost/147427 "2008-09-01T19:02:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 1, 2008, 7:02pm UTC](https://www.ruby-forum.com/t/lightbox2-javascript-file-behavior-different-on-web-server-and-localhost/147427/1 "2008-09-01T19:02:57Z")

</div>

I am running locally and using Lightbox2 (  
[Lightbox2](http://www.lokeshdhakar.com/projects/lightbox2/))  
to open a picture from a thumbnail

see site : [http://www.ceramique-isabelle.fr](http://www.ceramique-isabelle.fr) (see ceramiques, click  
thumbnail, then click the left picture)

in my layout I wrote this line to load the js in sequence as stated by  
lightbox2  
\<%= javascript\_include\_tag ‘prototype’, ‘scriptaculous’, ‘lightbox’,  
‘widgEditor’, ‘application’, :cache =\> true %\>

and the lightbox link is :  
  
\<%= image\_tag( left\_box\_image(@c, @p), :size =\>  
@left\_image\_size, :border =\> 0, :id =\> ‘imageLeft’) -%\>  
   
with a helper to build the link according to the clicked image  
big\_image\_link(c, p)  
return “#{WWW\_HOST}/images/#{params[:controller]}/big/  
#{params[:controller][0,1]}” + c.to\_s + “d” + p.to\_s + ‘.jpg’

so locally I get : \<a href=“[http://localhost:3000/images/aquarelles/](http://localhost:3000/images/aquarelles/)  
big/a1d0.jpg” …  
and the image displays into the lightbox.

I can even use a link to my web server, and running locally , the  
image displays too… !  
\<a href=“[http://www.ceramique-isabelle.fr/images/aquarelles/big/](http://www.ceramique-isabelle.fr/images/aquarelles/big/)  
a1d0.jpg” …

but when running from the web server, the image doesn’t display, I get  
a js error :  
Error : Builder is not defined  
Source file :  
[http://www.ceramique-isabelle.fr/javascripts/all.js?1220286151](http://www.ceramique-isabelle.fr/javascripts/all.js?1220286151)  
LIne : 4417

then (which seems normal to get this 2 error after the first… )  
Error : $(“overlay”) is null  
Source file :  
[http://www.ceramique-isabelle.fr/javascripts/all.js?1220286151](http://www.ceramique-isabelle.fr/javascripts/all.js?1220286151)  
Line : 4494

what could be different between my web server and my local server …  
(same Rails level… 2.1)

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 1, 2008, 7:54pm UTC](https://www.ruby-forum.com/t/lightbox2-javascript-file-behavior-different-on-web-server-and-localhost/147427/2 "2008-09-01T19:54:33Z")

</div>

On 1 Sep 2008, at 18:02, Erwin wrote:

> I am running locally and using Lightbox2 ( [Lightbox2](http://www.lokeshdhakar.com/projects/lightbox2/))  
> to open a picture from a thumbnail

Does it work when running in production mode locally ?

Fred

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 1, 2008, 9:03pm UTC](https://www.ruby-forum.com/t/lightbox2-javascript-file-behavior-different-on-web-server-and-localhost/147427/3 "2008-09-01T21:03:40Z")

</div>

yes, at least I hope so… (never run in production mode  
locally … just RAILS\_ENV=production in the console ?..)

the javascript error is actually Builder not loaded…  
in the scriptaculous file :

(includes ? includes[1] :  
‘builder,effects,dragdrop,controls,slider,sound’).split(’,’).each(  
function(include) { Scriptaculous.require(path+include  
+’.js’) });

I am quite sure it’s a js file loading problem… not a Rail  
problem,  
but what could be the difference between being local dev and remote  
production … ???

I modified the header…

 still running fine locally .. but same problem on web server (crashed one hour ago... not my fault...°

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 1, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/lightbox2-javascript-file-behavior-different-on-web-server-and-localhost/147427/4 "2008-09-01T21:09:31Z")

</div>

On Sep 1, 8:02 pm, Erwin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am quite sure it’s a js file loading problem… not a Rail  
> problem,  
> but what could be the difference between being local dev and remote  
> production … ???

Because in production mode those files are cached and combined into  
one, but not in dev mode

Fred

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 2, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/lightbox2-javascript-file-behavior-different-on-web-server-and-localhost/147427/5 "2008-09-02T12:15:55Z")

</div>

OK, I solved it testing direct links to js file …

 solved it..... not loading the scriptaculous.js file did the trick..... thanks for your help..
