Search code examples
javascriptwordpresscloudflarerocketscript

Remove CloudFlare sript from header?


I'm currently modify a site left from the previous developer. I'm working to modify some javascript. However, all of my changes only works in my localhost site, and not the staging site. I viewed the source code on browsers and see those script links has changed to something like this <script type="text/rocketscript" data-rocketsrc='...'></script> which I believe my updated JS codes won't work because of that.

I also see the cloudflare cdn code above it as well:

<script type="text/javascript">
//<![CDATA[
try{if (!window.CloudFlare) {var CloudFlare=[{verbose:0,p:0,byc:0,owlid:"cf",bag2:1,mirage2:0,oracle:0,paths:{cloudflare:"/cdn-cgi/nexp/dok3v=1613a3a185/"},atok:"204f23173dc3b0ee3fe57272b30ddbf2",petok:"6d99c6da0f9c5af0b780fc54f705ae1b6732742a-1439571640-1800",betok:"1b5c428c2c19f5473b41af6d945e42424041cb79-1439571640-120",zone:"hagarstage.com",rocket:"a",apps:{}}];document.write('<script type="text/javascript" src="//ajax.cloudflare.com/cdn-cgi/nexp/dok3v=e9627cd26a/cloudflare.min.js"><'+'\/script>');}}catch(e){};
//]]>
</script>

But my localhost site does not have this kind of script loading.

I explored all the plugins and there is no cloudflare related plugins installed. I believe that my codes will take effect once I have removed this script.

I see the link here https://wordpress.org/support/topic/cloudflare-code-left-after-uninstalling. However, no one answered it. So is there any way to completely remove this script?


Solution

  • We would only insert that JavaScript if the site was on the CloudFlare network in some way (signed up directly/through a hosting partner). It looks like Rocket Loader is turned on & turning on optional performance features (like Rocket Loader) or apps would inject JavaScript on your site that are running through the proxy (that's why you see a difference checking your server directly).