Fixed “no element found” error in Firefox
-
I got error message “no element found” every couple seconds when I use the P2 theme.
Error: no element found
Source File: wp-admin/admin-ajax.php?p2ajax=true&action=get_latest_comments&load_time=2011-01-17%2021:51:21&lcwidget=false&…
Line: 1To solve this problem I did this works:
1. check if this a special problem only happened on my site.
– I checked other sites they use the P2 theme. Show the same error in FireFox. So I know this is a bug of P2 theme.2. How to fix it?
– find and read the get_latest_comments function in ajax.php
– P2 theme check for new posts/comments every 30 seconds (“30000″ , this can be changed in the js.php).
– If no new comments found, return header(“HTTP/1.1 304 Not Modified”) in the function get_latest_comments.* I think here is the problem.
Firefox is expecting to get something it can parse as XML back, and throwing an XML parsing error when it gets an empty response. So I replaceheader(“HTTP/1.1 304 Not Modified”)
with
header(‘Content-Type: text/plain’);, and Firefox will not try to parse the response as XML, and there should be no error.
– also made the same change in get_latest_posts function.
It works.
The topic ‘Fixed “no element found” error in Firefox’ is closed to new replies.