NoWar
NoWar

Reputation: 37632

JQuery does not work using computer name under Internet Explorer 11

I have following MasterPage code of ASP.NET WebForm app.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="<%= this.ResolveUrl("~/Content/bootstrap.min.css") %> " rel="stylesheet" />
    <link href="<%= this.ResolveUrl("~/Content/bootstrap-theme.min.css") %> " rel="stylesheet" />
    <link href="<%= this.ResolveUrl("~/Content/bootstrap-datetimepicker.min.css") %>  " rel="stylesheet" />
    <link href="<%= this.ResolveUrl("~/Content/reports.css") %> " rel="stylesheet" />
    <script src="<%= this.ResolveUrl("~/Scripts/jquery-1.9.1.min.js") %>"></script>
    <%--<script src="/Scripts/moment-with-locales.min.js"></script>--%>
    <script src="<%= this.ResolveUrl("~/Scripts/moment.min.js") %>"></script>
    <script src="<%= this.ResolveUrl("~/Scripts/bootstrap.min.js") %>"></script>
    <script src="<%= this.ResolveUrl("~/Scripts/bootstrap-datetimepicker.min.js") %>"></script>
    <script src="<%= this.ResolveUrl("~/Scripts/es.js") %>"></script>
    <script src="<%= this.ResolveUrl("~/Scripts/reports.js") %>"></script>

    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="formMain" runat="server">
        <div>
            <asp:ContentPlaceHolder ID="ContentPlaceHolderMain" runat="server">
            </asp:ContentPlaceHolder>
        </div>
    </form>
</body>
</html>

And I have code for Bootstrap Datatimepicker

$(function () {
    $('.datepicker').datetimepicker({
        locale: 'es',
        maxDate: 'now',
        format: 'DD/MM/YYYY'
    });
});

All this code works just fine when i use IP address of the host like

http://10.1.5.34/MyWebsite/Report1

But when I use computer name it does not work

http://MyPCName/MyWebsite/Report1

I cannot see any errors but what is strange that Chrome displays all things properly under http://MyPCName/MyWebsite/Report1

So it has something to do with IE 11...

I have now clue how to fix it. Any clue?

Upvotes: 1

Views: 589

Answers (1)

Kld
Kld

Reputation: 7068

It is related to Compatibility View and "Smart Defaults".

IE uses different Browser Mode or Document Mode between the two instances.

You can force IE to use the same mode by setting the registry value or adding this to the page header

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

Upvotes: 3

Related Questions