31869

Images in one file under IE6 WITHOUT php

I need to create a page with all images and CSS in it, so it would be only one file.

I know that there is something like MHT (IE web archive), BUT there is problem. It works only in IE and Opera, not in FF. And i need my page to be working in all IEs (6+), Opera and FF. I know there is a way to encode my images in base64 and I also know, that IE 6 and 7 does not support data URLs. I've seen Dean Edward's trick for IE 6 and 7 but it works only with PHP support. And I can't use PHP, so this isn't working for me.

So, is there any way to create this kind of page? Please don't give me answers like "who is using IE6 today" or "install chrome frame". I know all this, but I need it to be working this way.

Thanks for the answer!

Answer1:

There is no cross-browser way to integrate all resources into one HTML file.

Your best bet is probably to serve a .MHT file for IE, and one with data: URIs for Firefox et al.

In some situations, a viable compromise may be serving a ZIP file that contains all resources, referenced using relative URLs. The user just has to unpack it, and can view it locally.

Answer2:

I can only think of one solution that will work in all browsers, and that is building an image from html elements, but it will be very much work to do so (per pixel or other strategy). Maybe jQuery can help a little. Also this might slow IE6 down (even more than normal...)

example: http://jsfiddle.net/huSq3/1/

I know it isn't much of a solution but I had to mention it. Now I'm thinking of it maybe you can use the canvas tag in combination of this javascript library for IE and draw the images to that via javascript.

Answer3:

Maybe you could use html conditional comments to decide which solution to use between MHT, data url, or any other partially supported solution...

Answer4:

If you are OK with the base 64 string in the image tag, then just hardcode it, then you do not need php

Recommend

  • jQuery UI Autocomplete with scrollbar z-index help
  • Parse AJAX resposne in HTML using Javascript
  • Javascript get plain text from server
  • How to prevent cross domain issues by proxying in IIS?
  • How to mock current date?
  • Get count of created entries for each day
  • Send emails through VB6 if no email client
  • NHibernate manually control fetching
  • how to set variables in a php include file?
  • OSX - always hide certain files
  • Compiling dlib on OS X
  • How to generate and display a QR Code in ionic 2
  • Check for zero lines output from command over SSH
  • wxPython: displaying multiple widgets in same frame
  • Is playing sound in Javascript performance heavy?
  • How to define and use opencv mat of user type
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Chrome doesn't support silverlight anymore? How to solve this?
  • Yii2: Config params vs. const/define
  • Extracting HTML between tags
  • Ajax Loaded meta Tags
  • R - Combining Columns to String Based on Logical Match
  • Linq Objects Group By & Sum
  • Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel
  • Optimizing database types to compact database (SQLite)
  • Javascript convert timezone issue
  • vba code to select only visible cells in specific column except heading
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • Jquery - Jquery Wysiwyg return html as a string
  • Arrays break string types in Julia
  • A cron job substitute?
  • json Serialization in asp
  • Buffer size for converting unsigned long to string
  • KeystoneJS: Relationships in Admin UI not updating
  • WPF Applying a trigger on binding failure
  • Java static initializers and reflection
  • embed rChart in Markdown
  • reshape alternating columns in less time and using less memory
  • Unable to use reactive element in my shiny app