WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Unnecessary Java Script Call (12 posts)

  1. Arafin Shaon
    Blocked
    Posted 2 years ago #

    While Analyzing my site with with gtmetrix along with google page speed found a java script call i think which is totally unnecessary. Is there any way to stop it!

    http://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201234

    http://wordpress.org/extend/plugins/jetpack/

  2. Arafin Shaon
    Blocked
    Posted 2 years ago #

    http://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201234

    along with above this is another unnecessary java script call

  3. Beau Lebens
    Member
    Plugin Author

    Posted 2 years ago #

    That file is used to optionally load retina/HiDPI versions of files (Gravatars etc) which are known to support it, for devices that run at a higher resolution.

    If you definitely don't want it, you could try de-queueing it (this code is untested, but something like this should work):


    function dequeue_devicepx() {
    wp_dequeue_script( 'devicepx' );
    }
    add_action( 'wp_enqueue_scripts', 'dequeue_devicepx', 20 );

  4. seriocomic
    Member
    Posted 2 years ago #

    Thanks Beau,

    This should be built-in by default for when that module isn't activated...
    [update: script is still being called]

  5. Beau Lebens
    Member
    Plugin Author

    Posted 2 years ago #

    Actually that script is not part of any specific module, it's loaded by the Jetpack core files. We may potentially split it out into a separate file, but we figured that for 3Kb, it's worth loading to improve the experience where possible. We'll take your suggestion into consideration, and maybe include details in support docs on how to remove it if you really don't want it.

  6. Arafin Shaon
    Blocked
    Posted 2 years ago #

    works pretty fine @Beau. But how about below link? is it possible to stop like above?

    http://www.tricksforblogger.com/wp-content/plugins/jetpack/modules/sharedaddy/sharing.css?ver=0.3.1
  7. Robert Accettura
    Member
    Posted 2 years ago #

    Noticed the same problem. The dequeue trick does seem to work for me, however it really shouldn't be in core making a request to another origin. Especially given for many sites HiDPI displays account for maybe a percent of traffic today.

  8. Arafin Shaon
    Blocked
    Posted 2 years ago #

    Working fine for me @Rober check my site with gtmetrix.com. Simply add the code to your functions.php file. Hope this time it will work. But i need to stop sharedaddy query string. still waiting for the solution :(

  9. Beau Lebens
    Member
    Plugin Author

    Posted 2 years ago #

    @arafinshaon: stopping that one will prevent the sharing buttons from displaying properly.

    Using a similar trick, you could also dequeue the sharing css


    function dequeue_sharing() {
    wp_dequeue_style( 'sharing' );
    }
    add_action( 'wp_head', 'dequeue_sharing', 20 );

  10. WraithKenny
    Member
    Posted 1 year ago #

    nm.

  11. Jason
    Member
    Posted 1 year ago #

    This devicepx BREAKS my site layout.

    :( :( :(

  12. Pothi
    Member
    Posted 1 year ago #

    Thanks Beau for providing the solution and thanks for @arafinshaon for creating this thread!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic