Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Google's PageSpeed Insights allows one to check a website's speed issues for both desktop and smartphone devices.

I have some media query CSS for smartphones on my website, but I am unsure about PageSpeed's smartphone screen size. Does anyone know the screen width?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

As stated in Google's PageSpeed Insights FAQ:

Does PageSpeed Insights use a real device?
PageSpeed Insights' analysis does not use real devices. PageSpeed Insights fetches a site with a webkit renderer (the same rendering engine that powers Chrome and Safari) that emulates both mobile device and desktop devices.

Therefore, screen width should not be a factor as it will render accordingly in WebKit.

As long as you're using a common screen width, you should be fine. As stated in Google's Webmaster Central Blog on Responsive Design and Media Queries:

The default viewport width for the default Android browser is 800px, and 980px for iOS,

So for both target OS's, you might use 800px for landscape smartphones, portrait tablets, and narrow desktops, and 479px for smartphones in portrait mode. An example from the blog is:

@media screen and (min-width:480px) and (max-width:800px) {
  /* Target landscape smartphones, portrait tablets, narrow desktops

  */
}

@media screen and (max-width:479px) {
  /* Target portrait smartphones */
}

The following is a list of viewport widths for specific devices should you need to target one: Web Design for Mobiles and Tablets – Viewport Sizes

Alternatively, using the following would set the viewport to the default width of the device automatically, and should work in PageSpeed Insights too:

<meta name="viewport" content="width=device-width, initial-scale=1">

In summary, if your screen width renders fine in mobile browsers, it should render fine in PageSpeed Insights as well.

share|improve this answer
    
Great answer thanks! –  JVerstry Aug 27 '13 at 9:01
    
You're welcome - hope it helps! –  dan Aug 27 '13 at 9:21
    
Good answer as usual ;-). –  Zistoloen Aug 27 '13 at 10:44
    
@Zistoloen Thanks - I try :-) –  dan Aug 27 '13 at 19:10

It's 320px wide.

To figure this out I ran Page Speed Insight (PSI) on a page with ranges of media queries that changed the background color at different breakpoints. After narrowing the width down to within 20px, I added a media query for every width within that 20px range until I found exactly the width PSI was using.

The reason this is (arguably) important is, for me, I was attempting to get my portfolio site a 100 PSI score as an exercise. My smallest media query is max-width="600px". I was using responsive images with picturefill setting the smallest image in the srcset to the largest the images would appear at my smallest breakpoint (600px + 80px padding = 520px wide images) but was getting an awful PSI score. Adding a smaller, 320px wide image to the srcset fixed the score.

The reason I say arguably is that, for real-world usage, my page was optimized perfectly without caring about PSI's viewport width. But my goal was specifically to get a high PSI score therefore it was important to figure this number out.

share|improve this answer
    
320px is the width that all iPhone web browsers use. Given that it is such a common size, it would make sense for Google to pick it. –  Stephen Ostermiller Nov 18 at 20:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.