#26221 closed defect (bug) (fixed)
Twenty Fourteen: wp_is_mobile() shouldn't be used
Reported by: | dimadin | Owned by: | lancewillett |
---|---|---|---|
Milestone: | 3.8 | Priority: | high |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | Cc: |
Description
[26026] introduced usage of wp_is_mobile()
function for determining size of thumbnail that should be displayed (see #25758).
Since wp_is_mobile()
checks current visitor, it should be used only on dynamic pages, how it was done in core before (used on admin pages only).
Although frontend is dynamic by default, when page cache is used it isn't. This can for example lead to situation where page view from mobile gets to cache which is then served to all visitors until cache is deleted/expires.
In this case, until browser supports for responsive images becomes standard, solution is to load full-width image or use some Javascript solution.
Attachments (1)
Change History (12)
#3
@
11 years ago
I think I agree with dimadin here. I discussed wp_is_mobile() usage with iandstewart before it landed, but this didn't occur to me. I wouldn't call this "aggressive" caching, just any kind of caching. Batcache, WP Super Cache, W3 Total Cache, any of them.
In the end, I don't think this is something the theme should be messing with. I totally get that we owe it to the world to serve smaller images to mobile devices, but this just isn't the right way to do it. We need to be dropping a cookie based on bandwidth and/or device. This is not something a theme, certainly not a default one, should be doing.
I'm also not in love with yet another image size, though I can't fault you for it. It would be nice to somehow figure out dynamic sizing at one point.
#6
@
11 years ago
26221.patch keeps the full-width image size for layouts without sidebars, while removing the wp_is_mobile
check.
#9
@
11 years ago
- Owner set to lancewillett
- Resolution set to fixed
- Status changed from new to closed
In 26599:
Let's discuss this more, I think the case of using a plugin with aggressive caching is valid. But, I think the tradeoffs are worth it.
For example, if the first visitor to populate the page cache is on a large monitor, the images will load too large for mobile visitors, but it'll still work just fine.