admin管理员组文章数量:1023131
I would like to display a JPEG image dynamically using iframe, but its header should be "Content-type: image/jpeg"
.
Is this possible?
This would be a workaround for displaying base64 images in IE7:
1) get base 64 code
2) decode it using js
3) generate iframe image
I would like to display a JPEG image dynamically using iframe, but its header should be "Content-type: image/jpeg"
.
Is this possible?
This would be a workaround for displaying base64 images in IE7:
1) get base 64 code
2) decode it using js
3) generate iframe image
Share Improve this question asked Jul 18, 2012 at 10:58 user669677user669677 2- Are you retrieving the base64 image from other website? – Jay Commented Jul 19, 2012 at 1:06
- @Jay No. But I dont want to send a request to my site to decode base64. – user669677 Commented Jul 24, 2012 at 14:33
2 Answers
Reset to default 1Maybe I did not get what you actually need (especially decode it using js part) but you can try some thing like this
var data64 = "your encoded staf..."
document.getElementById("divContent").innerHTML = "<iframe name='innerFrame' src='"+data64 +"'></iframe>";
Apparently the above code doesn t work for IE. you can use the below block instead.
var data64 = "your encoded staf..."
document.getElementById("divContent").innerHTML = "<iframe name='innerFrame'></iframe>";
var objDoc = window.frames[ "innerFrame" ].document;
objDoc.write("<img src='"+data64 +"' />");
you can also add an image to iframe document. But I would just use the adding a img tag to original page (parent page of the iframe.)
You'd want to return the content-type from the server returning the iframe source.
In other words if your iframe looked like: <iframe src="http://www.foobar./test.php>
, the test.php
should set the content-type to image/jpeg
I would like to display a JPEG image dynamically using iframe, but its header should be "Content-type: image/jpeg"
.
Is this possible?
This would be a workaround for displaying base64 images in IE7:
1) get base 64 code
2) decode it using js
3) generate iframe image
I would like to display a JPEG image dynamically using iframe, but its header should be "Content-type: image/jpeg"
.
Is this possible?
This would be a workaround for displaying base64 images in IE7:
1) get base 64 code
2) decode it using js
3) generate iframe image
Share Improve this question asked Jul 18, 2012 at 10:58 user669677user669677 2- Are you retrieving the base64 image from other website? – Jay Commented Jul 19, 2012 at 1:06
- @Jay No. But I dont want to send a request to my site to decode base64. – user669677 Commented Jul 24, 2012 at 14:33
2 Answers
Reset to default 1Maybe I did not get what you actually need (especially decode it using js part) but you can try some thing like this
var data64 = "your encoded staf..."
document.getElementById("divContent").innerHTML = "<iframe name='innerFrame' src='"+data64 +"'></iframe>";
Apparently the above code doesn t work for IE. you can use the below block instead.
var data64 = "your encoded staf..."
document.getElementById("divContent").innerHTML = "<iframe name='innerFrame'></iframe>";
var objDoc = window.frames[ "innerFrame" ].document;
objDoc.write("<img src='"+data64 +"' />");
you can also add an image to iframe document. But I would just use the adding a img tag to original page (parent page of the iframe.)
You'd want to return the content-type from the server returning the iframe source.
In other words if your iframe looked like: <iframe src="http://www.foobar./test.php>
, the test.php
should set the content-type to image/jpeg
本文标签: javascriptiframeset Content Type headerStack Overflow
版权声明:本文标题:javascript - iframe - set Content Type header - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745562044a2156219.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论