• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Need help from Wordpress Experts

Thanks bro, i will try that approach of de-activating cloudflare and see whether it fixes the issue.
@Milberg I did place the code before the </body> in footer.php file

pls check the screenshot here - https://ibb.co/xjGnN0H

can you verify if any mistakes ?
you must put it inside script tag like this.

JavaScript:
<script>
    function removeOnload(func)
{
    if(window.addEventListener)
        window.removeEventListener('load', func, false);
    else if(window.attachEvent)
        window.detachEvent('onload', func);
}

window.onload = removeOnload(parseJSAtOnload);
</script>

if you put the script above, then if you see in view-source the function parseJSAtOnload will still exist.
the code i provided above just only to make the function parseJSAtOnload will not loaded
 
Last edited:
  • Like
Reactions: sabs_rocks
@Milberg I did place the code before the </body> in footer.php file

pls check the screenshot here - https://ibb.co/xjGnN0H

can you verify if any mistakes ?
You need to place the code between script tags, the full code is this:
Code:
<script>
function removeOnload(func)
{
    if(window.addEventListener)
        window.removeEventListener('load', func, false);
    else if(window.attachEvent)
        window.detachEvent('onload', func);
}
window.onload = removeOnload(parseJSAtOnload);
</script>
 
Last edited:
Thinking about it, I'm afraid the above code will remove all instances of 'window.addEventListener', and there are a few others in the source code.

So, it's probably better to use the code in the link @webhugo provided because that only targets 'devicepx'. It will also completely remove the script from the source code.

You said before it didn't work, but I think you might have done it in the wrong file or in a wrong way. Make sure you add the code at the very end in functions.php. Make sure there's no closing php tag ('?>') just before it. There probably isn't, but just check it and if there is, start with an opening tag ('<?php'). Again, this is probably not needed, so I repeat the code here without any php tags:

PHP:
add_action( 'wp_enqueue_scripts', 'crunchify_enqueue_scripts_styles' );

function crunchify_enqueue_scripts_styles() {
   
     wp_dequeue_script( 'devicepx' );

}

I still think its better to search for the original code and remove it where it is added, but it seems you don't have much experience with source files, so if the above works, leave it at that.

Edit: thinking a bit more about it, that php function might indeed not work, because the devicepx script is probably in some file (and not enqueued with the handle 'devicepx'). Hm, so yeah, trying to find the file where it's added is still the best option IMO.
 
Last edited:
Thanks a bunch guys, now the 404 error due to devicepx.js is gone ! @frizzel @videva :)

However, the google tracking ( analytics) is still not working. When ran the site through the google chrome tools , getting the below issues :

"
Because a cookie's SameSite attribute was not set or is invalid, it defaults to SameSite=Lax, which prevents the cookie from being sent in a cross-site request. This behavior protects user data from accidentally leaking to third parties and cross-site request forgery.

Resolve this issue by updating the attributes of the cookie:

  • Specify SameSite=None and Secure if the cookie should be sent in cross-site requests. This enables third-party use.
  • Specify SameSite=Strict or SameSite=Lax if the cookie should not be sent in cross-site requests
"

Not sure whether this related to google analytics, but need to check on how to fix it... :(

Any suggestions are appreciated !
 
Thanks a bunch guys, now the 404 error due to devicepx.js is gone !
Yes, however it's just not loading but the code is still there, so I still think you should try that plugin I suggested to find where the code comes from.

Am I right in assuming you don't use a so-called child theme and have added the code in e.g. footer.php? If so, you'll have to edit that file every time the theme updates or the error will re-appear. So, again: find out where it's coming from.
 
Last edited:
Thanks @frizzel .

To try this approch, i reverted the code given by @videva from footer.php

I went ahead and installed the plugin.

Searched for 'devicepx' in whole wordpress directory, found it in 3 files of Cache directory for an deactivated plugin ( autooptimize ). Removed those files at backend.

However, still the devicepx is showing in site.

Also, when searched now the devicepx file is present only in backup .sql file present in \wp-snapshot folder taken last year. No other place it is present. Should i remove that also ?

When searched for 'parseJSAtOnload' string, again its only showing its present in backup .sql files in wp-snapshot

If i remove these .sql files, will it be any issue and could the issue be resolved ?
 
Backup .sql files should not have any impact on the live site, and removing them should also be of no consequence. If you want to be really sure, first download those files to your own computer before deleting.

However, what this DOES indicate is that Autoptimize got this from somewhere on your website, as the plugin only compresses and combines existing files. Maybe where it appears in the sql file gives some clue as to where it originated from. Can you check in what table it is? I suspect wp_posts which isn't really a clue, but maybe the text around the term might give some indications.

What bothers me is the invalid url for the devicepx script (s0.wp.com/…ontent/js/) which for me indicates it was manually added somewhere but incorrectly.
 
Wait a minute, you're using the latest WP version (5.5.1), but the version added to the end of the twitter and linkedin links included in that script's function is 4.9.7, so it seems it's a remnant of something you used long time ago.

But of course the question remains how it is still added there. Hopefully the text/code around the term in the .sql file gives a clue.

Since you now use a plug-in to defer (or async) javascripts, did you ever - say back in 2018 - hire someone to do that for you?
 
Last edited:
Thinking about it, I'm afraid the above code will remove all instances of 'window.addEventListener', and there are a few others in the source code.

So, it's probably better to use the code in the link @webhugo provided because that only targets 'devicepx'. It will also completely remove the script from the source code.

You said before it didn't work, but I think you might have done it in the wrong file or in a wrong way. Make sure you add the code at the very end in functions.php. Make sure there's no closing php tag ('?>') just before it. There probably isn't, but just check it and if there is, start with an opening tag ('<?php'). Again, this is probably not needed, so I repeat the code here without any php tags:

PHP:
add_action( 'wp_enqueue_scripts', 'crunchify_enqueue_scripts_styles' );

function crunchify_enqueue_scripts_styles() {

     wp_dequeue_script( 'devicepx' );

}

I still think its better to search for the original code and remove it where it is added, but it seems you don't have much experience with source files, so if the above works, leave it at that.

Edit: thinking a bit more about it, that php function might indeed not work, because the devicepx script is probably in some file (and not enqueued with the handle 'devicepx'). Hm, so yeah, trying to find the file where it's added is still the best option IMO.
1. the script i provided above is only to delete event listener from function parseJSonload. didn't remove all instances from another event listener.
2. wp_dequeue_script( 'devicepx' ); only work if jetpack plugin installed and the devicepx inside <script src="https://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201831"></script>
so if you put wp_dequeue_script it will not work on site techarea.in because the devicepx present inside array var links and the script will load after whole page has loaded
 
Last edited:
After trying many things, still could not get the issue of devicepx script resolved in my website. So, i am not able to track the traffic via google analytics.

Fortunately, its the time i have to renew my hosting service and due to high price i am going for a new hosting service ( hostinger). So can i take advantage of this migration and some how remove/resolve this devicepx issue ?

Any tips or methods i can follow during migration which will prevent this issue to be carried over to the new hosting service ?
 
After trying many things, still could not get the issue of devicepx script resolved in my website. So, i am not able to track the traffic via google analytics.
Sorry, but if you apply the code supplied by @videva correctly, that devicepx script is disabled and thus no longer blocking other scripts.

So, that is a solution, although it doesn't remove where that devicepx thing is added in the first place. Without knowing where it's coming from, it's impossible to say whether migrating to another hosting provider will solve that.
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock