Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 991221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:04:30+00:00 2026-05-16T06:04:30+00:00

I want to load higher resolution pictures for iPhone 4 users, but the only

  • 0

I want to load higher resolution pictures for iPhone 4 users, but the only way I know of detecting users is by a user-agent. But I’m under the impression that the user-agent of MobileSafari on any iOS4 phone is the same across the board.

What could I do to detect an iPhone 4?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:04:31+00:00Added an answer on May 16, 2026 at 6:04 am

    You can use CSS3 media queries to detect the iPhone 4’s device-pixel ratio (how many CSS pixels equal a physical display pixel). Then, you can use CSS to load higher-resolution images instead of the normal ones.

    In the <head> tag on your web page, add this to reference an external stylesheet that will only be loaded for iPhone 4 users:

    <link rel="stylesheet" type="text/css" href="high_res.css" media="only screen and (-webkit-min-device-pixel-ratio: 2)" />
    

    The media attribute specifies to only use this stylesheet for devices with a minimum device-pixel ration of 2 (ie. the iPhone 4). Then, you can add CSS rules in high_res.css to replace low-res images with high-res versions:

    #highres-if-possible {
        background-image: url(high_res_pic.png);
    }
    

    Note that you will have to specify the image in HTML by using the CSS background-image property instead of the src attribute.

    Example: for a 60×50 image, replace:

    <img id="highres-if-possible" src="low_res_pic.png">
    

    with

    <img id="highres-if-possible" style="width: 60px; height: 50px; background-image: url(low_res_pic.png);">
    

    No guarantee that specifying images like this will work in all browsers (Internet Explorer), but it should work fine in standards-compliant browsers (and on the iPhone).

    For more info on CSS3 media queries and using them to detect the iPhone 4, see: http://blog.iwalt.com/2010/06/targeting-the-iphone-4-retina-display-with-css3-media-queries.html

    UPDATE: I came across this post and this post that might have a better way to handle specifying the images using CSS (using <img style="background-image:url(http://...)"> instead of <img src="http://...">) than what I have above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load an XML document in Xerces-C++ (version 2.8, under Linux), and
I have database dump and I want load it to sqlite database on iphone
I want load xml documents, but there are special symbols like : ąčęėįšųū and
I want to load AlphaSkin's Imagelist from resource. Commonly I know, how to load
at first sorry my bad English I want load model in my plugin controller
I want to load defined folders into my website from same system, now I
I want to load some helper in a model. How to do this? Tried
I want to load key/values configuration pairs stored in XML file. To bind a
i want to load some photos into my sd card image in the emulator.
I Want to load Image size 2550X3300 (i.e 1.7 Mb size), i have loaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.