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';"/>