不同的行为,而使用本地主机和服务器名称 [英] Different behaviors while using localhost and server name

查看:106
本文介绍了不同的行为,而使用本地主机和服务器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想拖动一个div内的图像,这是我没有使用jQuery UI可拖动的功能。

I wanted to drag an image around inside a div, which I did using the jQuery UI draggable function.

HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="jQuery/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="jQuery/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
<script>
    $(document).ready(function () {
        $('#dragme').draggable();
    });
</script>
</head>
<body>
<div id="container" style="width:300px;height:300px;overflow:hidden;margin:auto;border:solid 1px black">
    <img src="http://img.thesun.co.uk/multimedia/archive/01650/greats_1650266a.jpg" id="dragme" />    
</div>
</body>
</html>

您可以在这里看到演示
做工精细,不过,问题开始时,我IIS上承载的是相同的。
当我使用http://本地主机/ mysite的,网页能正常工作的Chrome和IE浏览器,但是当我使用http://服务器/ mysite的,在IE浏览器,页面去的折腾。
整个图像显示在股利。
(快照)

我还可以拖动图像周围,虽然。

You can see the demo here. Works fine, however, the problem started when I hosted the same on IIS. When I use http:// localhost/mysite, the page works fine on Chrome and IE, however when I use http:// servername/mysite, on IE, the page goes for a toss. The entire image is shown on the div. (Snapshot). I can still drag the image around, though.

我不明白为什么会这样。我所遇到的问题,在过去以及其中ht​​tp的行为://本地主机/ mysite的和http://服务器/ mysite的有所不同

I fail to understand why this happens. I have encountered problems in the past as well where the behavior of http:// localhost/mysite and http:// servername/mysite have been different.

任何人都可以请解释为什么会这样?先谢谢了。

Can anyone please explain why this is happening? Thanks in advance.

推荐答案

兼容性视图(IE9 +)的而外部网站被加载在IE9 +标准查看IE加载本地Web应用程序。这就是为什么你在本地看到您的网站中的 IE7文档模式的原因。您可以通过点击F12,并更改为IE9文档模式改变这一点。如果你想在常规视图你的IE加载本地站点转到工具 - &GT;兼容性视图设置并从那里删除本地主机。

IE loads local web applications in compatibility view (IE9+) while external websites are being loaded in IE9+ standards view. This is the reason why you see your website locally in IE7 document mode. You can change this by hitting F12 and changing to IE9 document mode. If you want to make your IE load local site in regular view go to tools -> compatibility view settings and delete localhost from there.

这篇关于不同的行为,而使用本地主机和服务器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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