本地网站使用(IP 地址或机器名称)与 localhost 呈现不同? [英] Local website renders differently using (IP address or machine name) vs localhost?

查看:30
本文介绍了本地网站使用(IP 地址或机器名称)与 localhost 呈现不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have an MVC3 (razor) site published to IIS7 locally for testing purposes.

When I access the site via "localhost" it looks different from when I access using the IP address or machinename?

I have cleared my cache and re-loaded the pages to confirm and they still appear the different. The CSS must be loading to give the correct fonts/colours etc, although ":hover" elements appear to load much slower?

I am using JQuery/JQueryUI on the site if that helps identify the problem?

Any ideas?

Edit: More info

The titles, labels and table definition are build from ViewBag.Title, or looping through rows in a ViewModel - nothing clever, just standard MVC3/Razor stuff.

The same css file is used for every page, and F12 in IE8 shows the correct css has been loaded.

Title/subtitle font sizes/colours are correct, just their positioning is out? Table border appears thicker? Positioning generally seems a little "out", but I can't understand why there is this difference?

Can a firewall/AV package strip out positioning?

解决方案

The same css file is used for every page, and F12 in IE8 shows the correct css has been loaded.

Developer Tools should show that IE is not using the same "Browser Mode"/"Document Mode" between the two instances of the site, because that's the problem here. IE defaults to different modes depending on if you're using a machine name or not (amongst other things).

Adding this to your <head> should sort out the problem:

<meta http-equiv="X-UA-Compatible" content="IE=edge">

这篇关于本地网站使用(IP 地址或机器名称)与 localhost 呈现不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆