Javascript not working on Windows IIS server site

Posted on 2009-04-26
Last Modified: 2012-05-06
Site built as an ASP .Net 2.0 web site. Development PC running Visual Studio 2005 on Windows XP. Live site is hosted on Windows Server 2003 with IIS6

Once deployed to the server gallery Javascript is not working on the gallery page of the site.
- the gallery page displays items but clicking on them displays the image rather then the javascript enabled preview (using lightbox.js )

Site completely works on my machine but the gallery page does not work on the server
- to double check the site copied fromthe live server all the code for the site and did a full directory compare with my live site and one on my developer PC. Directory structure and files identical. Only difference was database connection string in web.config
- sites are therefore running same versions of javascript files and dependencies

Other javascipt files are working
- javascript is used for the pop-up menu and other places. It works in these places on the live site
- the javascript for the pop-up works on the gallery page. just the gallery javascript does not work

Paths are verified
- using FF web developer I have Viewed Jacascript. There are no 404's. All required files are listed

IIS settings look fine
- I have compared the settings on my local and live servers.
- Home Directory > Executable Permissions is set to Scripts and Executables.

Does anyone have any others ideas of what I can check or what I may have missed in things I have checked?
Question by:t-min
    LVL 18

    Expert Comment

    Well... any link that you can provide for this not working version ?:)))

    What you can miss? Some security polices, maybe caching (in Firefox I have to offen hit CTRL+R to reload and force to get stuff from server again, because browser cache it and gives me older version), maybe something else. Experts need to see it working on some test server to give you more info.

    Author Comment

    Thanks for suggestions, I have tried various refresh options, browser resets and reseting IIS.

    Link to the site with the problem (Site is not great coding. I have reworked an existing site. At this stage I wish I had of re-written it from scratch):

    Clicking gallery images loads the image rather then popping up in the lightbox.
    LVL 18

    Accepted Solution

    First of all:


    It doesn't work at all. The image opens up in a new window.
        This is commonly caused by a conflict between JS scripts. Check your body tag and look for an onload attribute. Example:
        <body onload="MM_preloadImages(/images/menu_on.gif)&;">
        A quick fix to this problem is to append the initLightbox() to the onload attribute as so:
        <body onload="MM_preloadImages(/images/menu_on.gif)&;initLightbox()">"

    You have at least 2 big frameworks there:

    jQuery and Prototype.

    Also what I see that:

    element.dispatchEvent is not a function
    [Break on this error] element.dispatchEvent(event);

    It seems that you did not put jQuery in non block mode. So both of those frameworks interferees each other and makes big #@@$#@ ;))) If you can - remove one. If you cant - just read about jQuery noConflict:

    If you make no errors on page then we can go further with finding your problem (but it might solve when proper onload will be called)


    Author Comment

    So the framework conflict is something that would appear on the server only?

    On my development machine the gallery behaves as required.

    Thanks for your ideas. I will look into you suggestions at work tomorrow.
    LVL 18

    Expert Comment

    Well the error I noticed in code - I follow it in firebug and its related with dom:onload   so I assume that something that should start onload of page does not start at all. And it seems that its a lightbox because it does not work :D

    Author Comment

    Thanks for pointing out that multiple frameworks were being used. I switched from a Prototype to a JQuery lightbox but still had the problem.

    I change the include order of the js libraries and it worked!


    Author Closing Comment

    Provided detail and lead to me to discovering the solution, thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now