"How to display a hexadecimal code stream as an image in HTML" is compatible with multiple browsers.

Source: Internet
Author: User

Original post: how to display a hexadecimal code stream as an image in HTML

Supported IMG labels for new browsers (ff3, IE8, and chrome), such as: Ivborw0kggoaaaansuheugaaabaaaaaqmaaaalpw0iaaaablbmveuaaad/
// + L2z/daaaam0leqvr4ngp4/5/h/1 + G/58zdraz3d/mch8yw83nddenge4u
G9c9zwz1_vlmda/a6p9/afggfyjoxztqaaaaaelftksuqmcc "/> format. You can specify the Encoding

This post has been published by the author, but the solution is not ideal. IE6 and IE7 are not supported, and the number of browser users using these two versions is not small.

We know that IE can package HTML and save it as an MHT file. This file contains scripts and images and is opened in notepad, which contains base64-encoded text.
For example:

   ------=_NextPart_000_0000_01CA69C7.3AF566D0
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Location: http://xxx.com/blank.gif
R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==

Open the page with IE and check that SRC is "MHTML: file: // X:/XXX/xxx. MHT! Http://xxx.com/blank.gif"

Ie uses the MHTML protocol to access this resource

The other path was discovered like this!

Test procedure

1. Is it successful to change file to HTTP?
2. Is it successful to change the MHT extension to HTML?
3. Place base64 characters in <! ----> Is the comment area successful?
4. Merge. Are multiple browsers tested successfully?

Thanks to ccav, everything went well.


Results page: http://renrousousuo.com/scripts/csdn_logo.html

This post should be divided into multiple scatter points.

Final source code (the logo is too big and changed to a thumbnail ):

------=_NextPart_000_0000_01CA9F59.AFB45FE0
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Location: logo.gif

iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/
//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U
g9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC!
-->

src="data:image/gif;base64,
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/
//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U
g9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC

"
onerror
="src='mhtml:' + document.location.href + '/scripts/csdn_logo.html!logo.gif';"/>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.