UI formatting messed up on IE when using IP address instead of localhost

本秂侑毒 提交于 2019-12-22 07:50:10

问题


I have an application developed using Primefaces 2.2.1 and JSF 2.0, deployed on Glassfish 3.1 local machine.

Problem is that when I access the application using http://localhost:8080/MyApp, the UI formatting is fine. But if I access the application using http://ip-address:8080/MyApp instead of localhost in the url, the UI formatting is kind of messed up.

This problem occurs only on IE (I have version 8.0), not on FF. What's the difference between using localhost:8080 and ip-address:8080 in the url? Following are the pictures that illustrate my problem.

Using http://ip-address:8080/MyApp:


Using http://localhost:8080/MyApp:

Thank you.


回答1:


Using a local (intranet) IP address forces IE to run in quirks mode which in turn exposes among others the IE box model bug, which you're seeing now. The IE box model bug incorrectly calculates the padding and border size as part of width. Just don't use local IP addresses when accessing a site in IE.




回答2:


IE > 7 is setup by default to run Intranet Sites in Compatibility Mode (ie IE7). This isn't quirks mode. You can turn this behviour off by setting Compatibilty View Options not to run in compat mode for Intranet sites.



来源:https://stackoverflow.com/questions/7325272/ui-formatting-messed-up-on-ie-when-using-ip-address-instead-of-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!