JavaScript critical error at line 5, column 9 in (

2019-02-14 21:53发布

问题:

I am using visual studio 2012

I have this simple html page, not asp.net page:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test Float</title>
    <link rel="stylesheet" href="Styles/style.css" />
</head>
<body>
    <div class="header"></div>
    <div class="slideBar"></div>
    <div class="content"></div>
    <div class="footer"></div>
</body>
</html>

I run it on google chrome. it works good.

when I debug it on internet explorer. I got this error:

Edit

For those who think that the sytle sheet is the problem. here is my style sheet

html, body {
margin:0px;
height:100%;
}
.header {
    width:100%;
    height:20%;
    background-color:red;
}
.footer {
    width:100%;
    height:20%;
    background-color:green;
}
.slideBar {
    width:20%;
    height:60%;
    float:right;
    background-color:blue;
}
.content {
    width:80%;
    height:60%;
    background-color:yellow;
}

It is working very good on google chrome and mozilla. the code is very very simple. just that IE11 is not

Edit2

After I added my html page link to the compatibility mode. I got this exception:

回答1:

Your browser is apparently running an add-on that injects scripts into loaded pages, and these scripts cause problems with IE11 (and 10).

You can configure Visual Studio to run IE in safe mode by adding an iexplore -extoff entry to the Browse With list and setting it as default, as explained here.

That said, I would recommend investigating which add-on is responsible for this situation, as it may have other adverse effects to your web usage (and to your privacy), and you may want to remove it if at all possible.



回答2:

You are on MSIEv11. Just a guess, but you might need to turn Compatibility Mode ON. [link]http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-11
You set that your page/website should have Compatibility View. Tap or click the Tools button Tools, and then tap or click Compatibility View settings. Under Add this website, enter the URL of the site you want to add to the list, and then tap or click Add.



回答3:

I just want to share my experience, in my case, I was using lambda expressions to find some elements in a list like

myList.find(ro => ro.field1 == field1); 

And internet explorer doesn't support lambda expressions.

I created some functions in order to find items.

It works.