PDA

View Full Version : Application doesnt work in IE and Chrome but works in FireFox



livinglegends
22 Sep 2010, 3:57 AM
Hi,

My application perfectly works in Firefox but doesnt works in IE or Chrome. It throws following javascript error.




Message: 'prototype' is null or not an object
Line: 135
Char: 21
Code: 0
URI: http://localhost:8080/pca/js/extjs/adapter/ext/ext-base-debug.js



Please let me know, what can be the problem?
I have checked all the things but didn't get any problematic area?

Thanks in Advance
Living Legend

troseberry
22 Sep 2010, 4:13 AM
Perhaps you can share the code your using that is producing the error. If I followed the error above correctly it seems to be happening during an "extend" operation. I would think that 'prototype' is null or not an object is a very basic error message that can be produced in a huge range of situations so makes it hard to tell you what the problem might be.

Dark Assassin
22 Sep 2010, 4:59 AM
if I know IE it returns you any errors, also missing commas or too much commas. So you've to try to check your code or post us!

livinglegends
22 Sep 2010, 5:00 AM
I have already check all javascript files for comma or multiple comma or even missing semicolon before posting here.

But I didnt get any and corrected where found but no luck.

livinglegends
22 Sep 2010, 10:17 PM
Waiting for the reply....

Anyone from Condor or Animal?

livinglegends
22 Sep 2010, 10:30 PM
Yes..you are right troseberry,

I have checked wherever I am getting this error and each line using Ext.Extend.

so, what can be the solution?

troseberry
23 Sep 2010, 3:18 AM
Hard to tell you without seeing the code

livinglegends
26 Sep 2010, 9:05 PM
Hi,

I got the rid of the problem but application stop to work on IE and Chrome.

What I did:
1. I am calling only config.js file which read configuration data from the database (Using AJAX) and on success of it, I am adding javascripts to header part as show below.



var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'javascriptpath/javascript.js';
head.appendChilde(script);I am adding all the js files as per the below code in head tag.

So, it has started to work in FF but stopped in IE and Chrome.

What can be the problem?

livinglegends
27 Sep 2010, 12:29 AM
No one?

rbastic
28 Sep 2010, 4:39 AM
'head.appendChilde' --> You mean appendChild?

It will be hard for anyone to help you further without seeing full code examples producing the problem.

KRavEN
28 Sep 2010, 11:19 AM
Also make sure none of your javascript variables or methods are named the same as a javascript function like var delete='delete'. This will work okay in firefox but not chrome or IE.

kubens
28 Sep 2010, 12:08 PM
If you want to load additional JavaScript files on demand then you should try to use getScript from jQuery library (http://api.jquery.com/jQuery.getScript/). I am using this to ensure that page loads fast and without all ExtJS and additional JavaScript files. If user wants to open an application I just load all required JavaScript files on demand:



<script type="text/javascript" src="/site.js/jquery1.4.2/jquery.js"></script>
<script type="text/javascript">

var App = function(){
return {

/*
* returns application window
* either existing or new created on demand
*/
getWindow: function(app)
{
var win = Ext.getCmp(app.id+"Window");
if (! win)
{
win = new Ext.Window({
id: app.id+"Window"
,onEsc: Ext.emptyFn
,plain: true
,border: false
,width: 400
,height: 600
,animCollapse: false
,closeAction: 'hide'
,maximizable: true
,minimizable: true
,layout: 'border'
,title: app.title
,items: app
});
}
return win;
},

/*
* load libraries and
* execute registered call back functions
*/
loadLibrary: function(lib)
{
var tlib, libs;

libs = $.isArray(lib) ? lib : [lib];
tLib = libs.shift();
tLib.libs = libs;

if (typeof tLib.className == 'undefined')
{
$.getScript(tLib.script, function()
{
if (tLib.cb)
{
tLib.cb();
}
if (tLib.libs && tLib.libs.length > 0)
{
App.loadLibrary(tLib.libs);
}
});
}
},

/*
* load application and open application
*/
loadApp: function(app)
{
if (typeof Ext == 'undefined')
{
App.loadLibrary([
/*
* load & initalize ExtJS libraries
* ext-jquery-adapter.js
* ext-all.js
*/
{ script: '/site.js/extjs/3.3b2/adapter/jquery/ext-jquery-adapter.js' },
{ script: '/site.js/extjs/3.3b2/ext-all.js',
cb: function() {
Ext.BLANK_IMAGE_URL = '/site.js/extjs/3.3b2/images/default/s.gif';
Ext.QuickTips.init();
Ext.Ajax.timeout = 10000000;
}},
/*
* load base classes and
* load application
*/
{ script: '/site.js/extjs/ux/extjs.ux.component1.js' },
{ script: '/site.js/extjs/ux/extjs.ux.component2.js' },
{ script: '/site.js/extjs/ux/extjs.ux.component3.js' },
{ script: '/site.js/extjs/ux/extjs.ux.component4.js' },
{ script: '/site.js/extjs/app/extjs.app.wak.base.js',
cb: function() {
App.loadApp(app);
}}
]);
}
else
{
/*
* if application is not loaded before
* load it and open application
*/
if (! Ext.ComponentMgr.isRegistered(app.xtype))
{
App.loadLibrary({
script:app.script,
cb: function() { App.openApp(app); }
});
}
else
{
App.openApp(app);
}
}

},

/*
* open application as window
*/
openApp: function(app)
{
var win = App.getWindow({id: app.id, xtype: app.xtype, title: app.title });
win.show();
}


}
}();

</script>

<body>

<a href="#" onclick="App.loadApp({ id: 'app1', xtype: 'wakapp1', script: '/site.js/extjs/app/extjs.app.wak.test1.js', title: 'Application Test 1' });">Open Application Test 1</a>

</body>


If you are irritated by the used version of ExtJS (3.3b2) then you can ignore this. I used same logic since ExtJS 2.x. But as mentioned by other guys without further details or examples we can not help you ;-)

Wolfgang

Dark Assassin
29 Sep 2010, 8:04 AM
maybe head.appendChilde must become head.appendChild.....

livinglegends
29 Sep 2010, 8:13 PM
maybe head.appendChilde must become head.appendChild.....

Ohhhh ..it is writing mistake only dear.....

it is appendChild, but not working...

Animal
29 Sep 2010, 11:18 PM
Hi,

My application perfectly works in Firefox but doesnt works in IE or Chrome. It throws following javascript error.




Message: 'prototype' is null or not an object
Line: 135
Char: 21
Code: 0
URI: http://localhost:8080/pca/js/extjs/adapter/ext/ext-base-debug.js



Please let me know, what can be the problem?
I have checked all the things but didn't get any problematic area?

Thanks in Advance
Living Legend

:-/ You haven't started the IE8 debugger, stopped execution there and actually investigated then?

You just threw the message out here as the first thing?