PDA

View Full Version : Ext.form.FormPanel load() errors loading url from local file



capn
11 Jun 2009, 8:12 AM
Here is test code - it is just a simple window to test loading a url, and loading url data within a frame.

this displays without error in ie6.

but shows this error when in firefox:
uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI)


what else is wrong with the code?




Ext.onReady(function(){
var urlstring='yourServer/formdata.jsp';
var form;
var submitbtn = new Ext.Button
({
text: 'load from file',
listeners:{click:function()
{
form.load({
url: urlstring,
waitMsg: 'Loading data...'
});
}}
});
var field_name=
[
'field1',
'field2'
];
form = new Ext.form.FormPanel
({
title:'urltest:'+urlstring,
height:250,width:300,layout:'absolute',
items:
[
new Ext.form.TextField({x:2,y:2+24*0,name:field_name[0],value:'<field1>',selectOnFocus:true}),
new Ext.form.TextField({x:2,y:2+24*1,name:field_name[1],value:'<field2>',selectOnFocus:true}),
new Ext.Panel({width:250,height:170,x:2,y:2+24*2,autoLoad:{url:urlstring}})
],
bbar:[submitbtn]
});
var win = new Ext.Window
({
x:1,y:1,layout: 'fit',
items: [form]
});
win.show();
});

11 Jun 2009, 8:33 AM
is it a relative URL to the domain that you're serving the page?

capn
11 Jun 2009, 10:08 AM
it's a plain html page in local directory calling url of server since it's only a test- so it's using absolute path here.

11 Jun 2009, 10:32 AM
you shouldn't be getting this issue at all.

what do you see being requested in firebug? anything?

capn
12 Jun 2009, 7:03 AM
uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI)

capn
12 Jun 2009, 7:07 AM
NS_ERROR_DOM_BAD_URI in Firefox (http://www.webmaster-talk.com/javascript-forum/158783-ns_error_dom_bad_uri-in-firefox.html)

"I found the solution. Apparently it's caused because I was loading the file into Firefox locally. If I upload it to our server and run it, it works fine."

"Works on my browser because I changed the security, but it doesn't work on anyone else's browser... I need a valid solution for other users..."

"javascript should not be allowed to access files on another domain, due to the cross site scripting potential."

capn
12 Jun 2009, 7:29 AM
does anyone know how to set security features in firefox to ignore this?