开发者

Embed an image nested inline within an HTML page for IE7+

Is there a way for nesting an image in an HTML page *inline* in IE7?

I can't use external resource, all because of a particular server configuration (it's a web dispatcher in maintenance mode that redirects all requests to a single .html page).

So I can't afford using the classical embedding by using the following:

<html>
 <img src="mypic.jpg" />
</html>

When looking for a solution, I found these:

  • Using inline SVG within an XHTML file # => I can't use XHTML extension in my case the page has the .html e开发者_高级运维xtension (and I can't change it)
  • Using base64 encoding # => It works pretty well with Firefox & Chrome, but not in IE7

None of which seem to be working in my configuration.

The more I seek the less I hope. Any ideas?


The only option, as far as I know, for embedded image in an HTML document for current versions of Internet Explorer is VML (which isn't supported by anything other than Internet Explorer).

You could use something like Raphaël to abstract the VML or SVG into a single JS script (but that would add a dependency on JavaScript).

That easiest option would probably be to reference a normal image on an external URI … on a different server.


For the svg solution, your page doesn't need to end in .xhtml. In fact, it can end in whatever extension is handled by your web server.

The page being in xhtml is defined by its doctype definition. Put the doctype definition of xhtml 1.0 (strict or transitional) or even better xhtml1.1 and embed svg in the page.

As an alternate solution, you could try to output the image directly with an .html extension, keeping its original mime (image/jpeg for instance) but I'm not sure it would work.


Instead of redirecting to a single .html page, you could redirect to a single image and put your text on the image. This has obvious drawbacks, but how important is the image?

What you meant by base 64 encoded?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜