If viewing the same page in the same browser, but that page is hosted in two different places (in our case, locally v. over the internet) what kinds of things can cause it to display differently?

Assume that there is no server side processing, just HTML, CSS & Javascript.

Also assume, yes, we're definitely looking at the same page.

3 Answers 3


More information about exactly what changes would be useful, but regardless a few thoughts spring to mind:

  • The server could still have an impact, even with static pages. For example, .htaccess could come into play, or the file parsed as PHP and they get modified in some way (unlikely but possible). View source on the local and live pages to make sure they are exactly the same.

  • If you are running file:/// instead of http://localhost/ root-based links such as /styles.css won't work. You'd need to change them to relative links.

  • If you are opening the HTML file in Internet Explorer, some Javascript doesn't run. You normally get a warning about active content. Check your security settings. (If you are running http://localhost/ this shouldn't be an issue.)

  • The page uses some kind of AJAX or server-side connection that fails on localhost.

  • An ad blocker prevents certain scripts, images, files from loading, particularly if they reference the internet instead of locally.

  • 1
    +1 that's about as thorough an answer as can be given based on the premise, though @hawbsl should probably be taking a look at his browser console messages (FireBug comes to mind) and server error logs to save some time poring over HTML source
    – danlefree
    Commented Oct 25, 2010 at 13:28

The main difference I could see would have to do with the .htaccess

  1. XHTML served as application/xhtml+xml instead of text/html, or vice versa
  2. IE isn't letting Javascript run locally or differently online

I'm sure there is more, I just can't think of it right now.


First cause of errors to display a page on a server rather than in your local machine is absolute/relative paths.

If some files cannot be found, like an external stylesheet, it is kinda obvious that it will display differently (and a lot diferently).

Second most common cause would be the server and mime/types as mentioned per eli.gundry. Another cause can be inside the server also, .htaccess (a file that can change some behaviors).

Well, supposing all links and paths are okay, and the server is serving the right mime/type, and .htaccess is not making any surprises (oh, yeah, SSI - server-side includes - can also do that), there is one option left that I can remember. File encoding.

You can script in your local machine as UTF-8 and server forces declaration to ISO 8859-1 for example, making your page display strange characters. For inspect this, use Firefox with Firebug, and check request and response headers within the tab "network".

And one last tweak about this encoding stuff is, if you code with UTF-8, pay attention to with/without BOM (Byte Order Mask). The best tool I know so far to check and fix this is notepad++, a lightweight editor that runs on Windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.