Jetpack by WordPress.com
Jetpack constantly calling device-jetpack.js (4 posts)

  1. gendalus
    Posted 9 months ago #


    I was just inspecting the performance of my site when I saw, that jetpack calls devicepx-jetpack.js over and over again and I don't really see why. I only enabled Mobile Theme and Statistics in the preferences.

    I'm using Safari 7.0.4 on OSX 10.9

    Here are two images out of the web inspector:

    For me it seem's like a bug. Is this intended behavior?


  2. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 9 months ago #

    devicepx-jetpack should be running when the resolution of your screen or the page changes. For example, if you drag a window between a retina and non-retina display, or if you're on a hidpi display, it will upsize any photon'ed images or the like.

    What page is this happening on, so we can give it a look?

  3. enej
    Plugin Author

    Posted 9 months ago #


    Looking at the code of devicepx-jetpack.js it looks like devicepx-jetpack.js runs a function called 'zoomImages' every second. This function ensures that every image on your page looks great on retina displays.
    The reason it runs every seconds is to make sure if new images are loaded to the browser, for example using the infinite scroll, will be displayed nicely on retina displays as well. The action is pretty fast and skips images that have already been resized as well as is disabled if you are not using a device with a high resolution retina display.
    The graph that you are seeing I believe is not devicepx-jetpack.js being loaded every time but the inspector telling you that the browser is performing an action because of devicepx-jetpack.js, running the 'zoomImages' function.

    I have created a github issue looking to look further at optimizing the devicepx-jetpack.js script. https://github.com/Automattic/jetpack/issues/820

    Let me know if you have further questions or anything else you would like me to take a look.

  4. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 9 months ago #

    BTW, for the curious, here's the full unminified devicepx-jetpack.js --



You must log in to post.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.