?
Solved

WRONG_DOCUMENT_ERR: DOM Exception 4 in Safari/Chrome

Posted on 2009-02-08
1
Medium Priority
?
4,946 Views
Last Modified: 2013-11-18
I'm getting the following error in my jQuery/Javascript code when I run it on Webkit-based browsers: WRONG_DOCUMENT_ERR: DOM Exception 4. When I get the error, what I'm doing is loading an external XML document (that's XHTML compliant) and replacing one of the nodes in my original web page with a node from the XML document. This works fine in Firefox and Opera. Does anybody know how I get this to work? I posted the code below. Thanks.
$('.link').click( function() {
	// this.href must point to a well-formed XHTML file or the stylesheets won't work
	$.get(this.href, function(data, textStatus) {
		try {
			$('#main').replaceWith($('#main', data));
                        // there's a <div> node in the original web page with id="main" and a <div> node in the XML page with id="main"
		}
		catch(e) {
			alert(e);           // this gets triggered
		}
 
                // do more stuff
        }
}

Open in new window

0
Comment
Question by:tjgquicken
1 Comment
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 1500 total points
ID: 23585534
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question