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

  • SEARCH
  • Home
  • 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 8596531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:42:07+00:00 2026-06-12T00:42:07+00:00

I have a one page document that has several images which need to load

  • 0

I have a one page document that has several images which need to load only on Android 2.3 phones and IE8/9 because the picturefill.js project doesn’t work properly on those devices.

I am successfully using this script once within one of my instances of picturefill code:

var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid) {
  // Do something!
  document.getElementById('theimage').innerHTML = '<img src="http://placehold.it/200x200">;
}

I need to use it a few more times on the page but have problems when I paste the exact code above more than once.

Is there a way to turn the above into a function that can be called to call different images for each instance of the unique images? I would need to use the above script to call at least 6 unique images across the page.

  • 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-06-12T00:42:08+00:00Added an answer on June 12, 2026 at 12:42 am

    Once the code has executed once you don’t need the first 2 lines, as they are already set and redefining them can cause errors. Just use the if statement where necessary.

    First Time

    var ua = navigator.userAgent.toLowerCase();
    var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
    if(isAndroid) {
      // Do something!
      // Redirect to Android-site?
    }
    

    every subsequent time

    if(isAndroid) {
      // Do something!
      // Redirect to Android-site?
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PrintDocument that has several pages. One page in that document must
I have a one-page OpenOffice document which is a POD template. Basically, I use
I have a page that has three divs one at the top, one at
I have a C# webbrowser that holds an html page that has several iframes.
I have an ASP page that has 5 ASP ImageButtons. The images can be
I have a html page that has more than one head and body. The
So I have this page on one domain that has a script-tag pointing on
I have pdf document, for example 25 pages. How to add one blank page
I have one Page which is displaying details of some Client. I am using
I have one page website only using HTML, CSS and JavaScript. I want to

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.