Mansuro
Mansuro

Reputation: 4627

problem with extjs and internet explorer 8


I wrote a program with extjs library, the program works fine in all browsers, except internet explorer 8, the problem is, it works when i load it from localhost, but when accessed from the server, it doesn't load the page, i have a blank page,
I removed a comma and the program started working when accessed from the server. Does someone have an explanation?

here is the header:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta name="Description" content="Default Style" />
    <meta name="Version" content="2.1.1" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>project name</title>
    <link rel="stylesheet" type="text/css" href="./style/default/main.css" media="all" />
    <style type="text/css" media="all">@import "./style/default/main.css";</style>
    <link rel="shortcut icon" href="./style/default/images/favicon.ico" type="image/ico" />
    <script type="text/javascript" src="http://10.215.63.218/Apsys/js/base.js"></script>
<script type="text/javascript" src="http://10.215.63.218/app/js/collapse.js"></script>
<script type="text/javascript" src="http://10.215.63.218/app/lib/overlib/overlib.js"></script>
</head>

Upvotes: 2

Views: 17041

Answers (3)

Colin
Colin

Reputation: 21

For the difference between localhost vs your server, there is a setting in IE that forces internal websites into compatibility mode regardless of doctype. This would explain the difference between functionality if you have it set.

Either way, you should keep the good syntax and not have trailing commas in arrays or objects.

Upvotes: 2

AmorALess
AmorALess

Reputation: 11

Why Explorer works in localhost and not in a published server is a real mystery, but, check your HTML, my example runs correct in Chrome and Explorer 8 (in localhost) my error:

<body style="text-align:center">
<div id="bodyForm" style="width:100%;">
</div>
</body>

in app.js

renderTo: Ext.get('bodyForm')

I correct to:

<body id="idBody">
</body>

in app.js:

renderTo: Ext.get('idBody')

Upvotes: 1

Sean Adkinson
Sean Adkinson

Reputation: 8615

Internet Explorer can't handle trailing commas on objects and arrays. This becomes an especially recurring problem with Ext, where you regularly create large objects, one attribute per line, and comment/remove things a lot.

This will break in IE:

new Ext.Panel({
    id: 'mypanel',
    cls: 'my-panel-class',
    html: 'Some HTML',
    colors: [
        'yellow',
        'blue',
        'red',
        //'pink'
    ],
    renderTo: Ext.getBody(),
});

Notice the extra comma after 'red' and Ext.getBody() in the first block.

This will work:

new Ext.Panel({
    id: 'mypanel',
    cls: 'my-panel-class',
    html: 'Some HTML',
    colors: [
        'yellow',
        'blue',
        'red'
        //'pink'
    ],
    myArray: ['yellow', 'blue', 'red'],
    renderTo: Ext.getBody()
});

Upvotes: 12

Related Questions