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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:51:18+00:00 2026-05-24T03:51:18+00:00

Whenever i first loaded the page. The image doesn’t get restored but once i

  • 0

Whenever i first loaded the page. The image doesn’t get restored but once i load the page and i hit F5. then it works. i’m not where whats wrong with my code.

// variable r contains the base64 string which is retrieved via a ajax call.

    var myImage = new Image();
    myImage.src = r;
    var canvas = document.getElementById('myCanvas');
    var ctx = canvas.getContext('2d');
    ctx.drawImage(myImage, 0, 0);

Ok. Instead of calling the ajax automatically when the page is loaded, i manually triggered the ajax call via a button, still i get the same result.
The base64 strings is retrieved successfully and imaged is not loaded. but when i clicked the button for a second time. the image is than loaded.

  • 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-24T03:51:18+00:00Added an answer on May 24, 2026 at 3:51 am
    var myImage = new Image();
    myImage.src = r;
    var canvas = document.getElementById('myCanvas');
    var ctx = canvas.getContext('2d');
    // wait for it to load before calling draw
    myImage.onload = function() {
      ctx.drawImage(myImage, 0, 0);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having strange problem, whenever my site is loaded for the first time
I am working on my first iPhone app and making good progress. But there
After four weeks of learning Objective-C for the iPhone, my first useful application is
Delphi 2006, whenever started afresh, loses component package. This happens on a daily bases.
I have a simple WinForms solution in VS 2010. Whenever I build it, output
I have 3 pdf file for 1 chapter like pdf_chapter_1_page_1.pdf,pdf_chapter_1_page_2.pdf,pdf_chapter_1_page_3.pdf. In first chapter we
Whenever a user clicks the row header, which selects the whole row (and highlights
Whenever a query in PL/SQL is written where only one row is expected, there
First, a short description of the problem's background: I've run into troubles with handling
First, a little background. I have two ASP.NET web applications that use SQLServer session

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.