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 8384661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:27:39+00:00 2026-06-09T17:27:39+00:00

I am trying to clone an image which is generated randomly. Although I am

  • 0

I am trying to clone an image which is generated randomly.
Although I am using the exact same url a different image is load. (tested in chrome and firefox)

I can’t change the image server so I am looking for a pure javascript/jQuery solution.

How do you force the browser to reuse the first image?

Firefox:
Firefox Demo

Chrome:
Chrome Demo

Try it yourself (maybe you have to reload it several times to see it)

Code:
http://jsfiddle.net/TRUbK/

$("<img/>").attr('src', img_src)
$("<div/>").css('background', background)
$("#source").clone()

Demo:
http://jsfiddle.net/TRUbK/embedded/result/

  • 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-09T17:27:41+00:00Added an answer on June 9, 2026 at 5:27 pm

    You can’t change the image server if it isn’t yours, but you can trivially write something on your own server to handle it for you.

    First write something in your server-side language of choice (PHP, ASP.NET, whatever) that:

    1. Hits http://a.random-image.net/handler.aspx?username=chaosdragon&randomizername=goat&random=292.3402&fromrandomrandomizer=yes and downloads it. You generate a key in one of two way. Either get a hash of the whole thing (MD5 should be fine, it’s not a security-related use so worries that it’s too weak these days don’t apply). Or get the size of the image – the latter could have a few duplicates, but is faster to produce.
    2. If the image isn’t already stored, save it in a location using that key as part of its filename, and the content-type as another part (in case there’s a mixture of JPEGs and PNGs)
    3. Respond with an XML or JSON response with the URI for the next stage.

    In your client side-code, you hit that URI through XmlHttpRequest to obtain the URI to use with your images. If you want a new random one, hit that first URI again, if you want the same image for two or more places, use the same result.

    That URI hits something like http://yourserver/storedRandImage?id=XXX where XXX is the key (hash or size as decided above). The handler for that looks up the stored copies of the images, and sends the file down the response stream, with the correct content-type.

    This is all really easy technically, but the possible issue is a legal one, since you’re storing copies of the images on another server, you may no longer be within the terms of your agreement with the service sending the random images.

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

Sidebar

Related Questions

Im trying to clone facebook image uploader which is built in java. But I
I'm trying to clone my personal fork on github using the git+ssh protocol with
I am attempting to clone fields in a form using Jquery. I'm trying to
I'm using Isapi Rewrite 3 (mod rewrite clone for IIS) and trying to rewrite
I'm trying to calculate the (cross?) correlation between a template image (an image which
For the past few hours I have been trying to clone an image in
I'm trying to get an image from an URL but when I save it
I'm trying to save a users profile image on facebook using CURL. When I
I'm trying to download a PNG image from a Flash application using a Java
I am trying to make an android application in which if you drag image

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.