Fix AJAX bug created by web hosts who inject ads into html pages
|Reported by:||palotasb||Owned by:|
Most web hosting companies insert ads into HTML pages downloaded from them. This breaks some admin page features, because files downloaded via AJAX have a text/html header and the host automatically injects the ads. This sometimes creates a reload cycle or makes the page completely unaccessible.
I have fixed the issue partly by editing /wp-admin/admin-ajax.php at line 19 and /wp-admin/index-extra.php at line 18, by overwriting the Content-Type header to be text/plain. This does not fix the issue on the admin dashboard, where some widgets need to be disabled.
In case you want to reproduce, you have to set up a web server in a way that it injects some content into the body of every served file with the text/html MIME type.