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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:47:00+00:00 2026-06-05T11:47:00+00:00

HTML5 enable you to store data locally which I think it is great. For

  • 0

HTML5 enable you to store data locally which I think it is great. For example here is how you can use it:

var store = window.localStorage;
store.setItem('foo', "hellow world");
var test = store.getItem('foo');
// test should = "hellow world"

In HTML you can dynamically display an image by setting its source to:

"data:image/jpg;base64," + (base64string)

So my question is how can I convert binary data to a base64 string so that I can take advantage of html5 local storage?

For example it will be great if I could:

$.ajax({
   url: 'someImage.png',
   type: 'POST',
   success: function (r) {
                
      // here I want to convert r to a base64 string !
      // r is not binary so maybe I have to use a different approach
      var data = ConvertToBase64(r);
      document.getElementById("img").src = "data:image/png;base64," + data;

   },
});

I know I could solve this problem by wrapping the image around a canvas using html5 then converting that to base64string. also I can make a specific service on the server that will send a base64 string data of that image (someImage.aspx).I just want to know if it will by possible to retrieve binary data from a server and convert that to a base64 string.

  • 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-05T11:47:02+00:00Added an answer on June 5, 2026 at 11:47 am

    Try the btoa function:

       var data = btoa(r);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my HTML file (jQuery needed and enable HTML5 in FireFox about:config) <!DOCTYPE
Can Silverlight store data on a user's local machine if correct permissions are enabled?
How to enable opening links exposed via s:link in a new window http://www.jsftoolbox.com/documentation/seam/09-TagReference/seam-link.html
i want to enable facebox jquery using javascript. here in normal html <a href=stairs.jpg
HTML5 draft contains an API called EventSource to stream data (notifications) trough javascript using
I am looking to enable looping of HTML5 video in browsers that do not
I have a database that takes in data from a WYWSWIG enabled textarea, which
I am looking for a solution that can enable the mobile browser load a
I have installed Modernizr into my code to enable html5 placeholder support in firefox
I got a class AvatarUploader < Carrierwave::Uploader::Base which store User avatars in public/uploads dir:

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.