views:

464

answers:

6

I use the free webhost 000webhost. The service is okay but it inserts some javascript counter into every file and request. The script looks like this.

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"&gt;&lt;/script&gt;
<noscript><a href="http://www.hosting24.com/"&gt;&lt;img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->

If i do a jquery post it breaks my code and I get no response.

<?xml version="1.0"?>
<response>
 <status>1</status>
 <time>1266267386</time>
 <message>
  <author>test</author>
  <text>hallo</text>
 </message>
 <message>
  <author>test</author>
  <text>hallo</text>
 </message>
 <message>
  <author>test</author>
  <text>hallo</text>
 </message>
 <message>
  <author>test</author>
  <text>hallo</text>
 </message>
 <message>
  <author>admin</author>
  <text>hallo</text>
 </message>
</response>
<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"&gt;&lt;/script&gt;
<noscript><a href="http://www.hosting24.com/"&gt;&lt;img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->

How can I fix that? How can I remove the hosting javascript code?

+2  A: 

Try changing the content-type in PHP; that should help. (For example, I assume, it doesn't modify images)

Alternatively, you could remove the code in Javascript using indexOf and substring.

SLaks
+1  A: 

Check the terms of service agreement for your host. They may require their analytics code to run unadulterated as part of your TOS.

If they require this code to run, then there are 2 possible solutions:

  • Get a new host (see http://www.webhostingtalk.com for hosting reviews and deals)
  • Figure out what in your code is being affected and find a work around there.

If they do not require the analytics code block as a condition of service then you may be able to block their snippet from running by altering the tag's event handler via jquery that they use to fire their code.

Rob Allen
+7  A: 

They have a link in their cPanel where you can disable the analytics code.

http://members.000webhost.com/analytics.php

Catfish
A: 

Yes fixed it have a look http://www.chyd.co.cc/blogging/feedburner-setting-on-000webhost.html

streetparade
A: 

If you are using the $.ajax(); function, there is a dataFilter parameter that lets you modify the raw contents of the request before processing it. In here, you could either substring or replace out the offending text, or you could add a <!-- to the end of your XML file, then stick a --> at the end of the response in the dataFilter code.

Andrew Koester
A: 

The analytics code also creates 3 html errors when checked with the w3c validator, so this also lowers your website ranking with google, as google say their ranking also requires that your pages are well formed! try using the validator on this page HERE and you will see the 3 errors.

Philip
That's not really how PageRank works.
Arda Xi