I have a master page assigned to sites, subsites and pages. I have a warning (alert box) embedded within the master page.

It's working on the home page, but not working on the other sites/subsites/pages. But the code is there. How come its not working?

Also I'm having CSS problems, most likely the same as the JavaScript problem. It is working well on the home page but not working on the other pages.

I tried to reset the subsite's master pages to inherit from the current masterpage, but no luck :(

UPDATE : Turns out its check in problem. i slipped out. the masterpage not yet published to major publish. so non-admin user will still look the old masterpage. Cheers.


Are your js scripts and css styles defined in external .js and .css files which you reference from your masterpage? If so, make sure the urls to these files start with "/", basically telling the browser the url is server relative. If your url is something like "./library/script.js" or "library/script.js" it means the url is relative to the "folder" of the current page, which would explain why it only works on the root site as it's able to find your .js and .css relative to the root, but not on subsites where the context used to resolve relative urls is different.

  • about the IE, css turns good when i put the simulate as ie7 meta tags. but still no luck with the js. – user640 May 10 '10 at 14:24
  • So are you using external .js and .css files or not? If you are, have you checked the links? – Jaap Vossers May 10 '10 at 21:35

Can you use Firefox extension Firebug to see if the script is loaded and getting executed

  • Hi Thomson, Thanks. i am a firebug user too :) It is executed on the home page. but not on the sites/subsites/pages. even the basic javascript alertbox ( no need other js to run ). – user640 May 10 '10 at 14:23
  • On question though in your scripts tab in Firefox are u able to see the js file? When are u trying to call the alertbox in javascript? – Thomson May 11 '10 at 4:04

I assume you are working on the Publishing Sites, if you have problem with both CSS and JS...please check the reference path of the files (relative ) used in the master page

Quick Check : Temporarily change the reference path of the files from relative to absolute (http:///ZZZZ/ZZZ/ZZZ.js) and see if it works then you got the root cause and fix it using a proper relative path :)

regarding CSS its better to use the alternate CSS option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy