Mobile app version of vmapp.org
Login or Join
Turnbaugh106

: What possible causes are there for a page to display differently if hosted in two different places? If viewing the same page in the same browser, but that page is hosted in two different places

@Turnbaugh106

Posted in: #Html #WebHosting

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.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Turnbaugh106

3 Comments

Sorted by latest first Latest Oldest Best

 

@Lee4591628

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.

10% popularity Vote Up Vote Down


 

@Steve110

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


XHTML served as application/xhtml+xml instead of text/html, or vice versa
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.

10% popularity Vote Up Vote Down


 

@Cofer257

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 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 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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme