Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
NS_ERROR_DOM_BAD_URI in Firefox
Old 10-28-2008, 04:43 PM NS_ERROR_DOM_BAD_URI in Firefox
Skilled Talker

Posts: 53
Name: Dave
Location: Kansas, USA
Trades: 0
I have the following code that works fine in IE:
Code:
function divLoadHtml(sDiv, sURL)
{
  var objXMLHTTP, e
  try { objXMLHTTP = new XMLHttpRequest(); }
  catch (e) { try { objXMLHTTP = new ActiveXObject('Msxml2.XMLHTTP'); }
  catch (e) { try { objXMLHTTP = new ActiveXObject('Microsoft.XMLHTTP'); }
  catch (e) { objXMLHTTP = null; }}}
  objXMLHTTP.open( "GET", sURL, false );
  objXMLHTTP.send();
  document.getElementById(sDiv).innerHTML = objXMLHTTP.responseText;
  return;
}
However, in Firefox I get the error NS_ERROR_DOM_BAD_URI when I call it in Firefox.

Doing some research, I found a reference that says I cannot access files on another domain which is a problem. I need to access XML data on a domain different than the domain from which this code is executed.

Does anyone know of a work-around, other than forcing everyone to use IE (ugh)?

Last edited by dnavarrojr; 10-28-2008 at 04:52 PM..
dnavarrojr is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-28-2008, 04:53 PM Re: NS_ERROR_DOM_BAD_URI in Firefox
Skilled Talker

Posts: 53
Name: Dave
Location: Kansas, USA
Trades: 0
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.

http://kb.mozillazine.org/Editing_configuration
dnavarrojr is offline
Reply With Quote
View Public Profile
 
Old 10-28-2008, 05:06 PM Re: NS_ERROR_DOM_BAD_URI in Firefox
Skilled Talker

Posts: 53
Name: Dave
Location: Kansas, USA
Trades: 0
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...
dnavarrojr is offline
Reply With Quote
View Public Profile
 
Old 10-28-2008, 05:54 PM Re: NS_ERROR_DOM_BAD_URI in Firefox
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
javascript should not be allowed to access files on another domain, due to the cross site scripting potential.

The safe option is to use the XMLHttpRequest to request a script page on the same domain which in turn goes to the remote URI and streams the resource back.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-28-2008, 05:59 PM Re: NS_ERROR_DOM_BAD_URI in Firefox
Skilled Talker

Posts: 53
Name: Dave
Location: Kansas, USA
Trades: 0
Quote:
Originally Posted by chrishirst View Post
javascript should not be allowed to access files on another domain, due to the cross site scripting potential.

The safe option is to use the XMLHttpRequest to request a script page on the same domain which in turn goes to the remote URI and streams the resource back.
Yech, but yeah....
dnavarrojr is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to NS_ERROR_DOM_BAD_URI in Firefox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36959 seconds with 12 queries