How to embed a resized website throught an iframe?

2019-02-23 09:40发布

I need to embed a website in another website ( throught an iframe I think ). I want to embed this website in this resolution: 200x150 pixel.

How can I do that ?

5条回答
仙女界的扛把子
2楼-- · 2019-02-23 10:22

Just in case someone wanders in here. Solution in https://stackoverflow.com/a/11382661/605112. Same problem in different context. Set iframe to desired width and height and use CSS to scale it. May not work in all browsers.

<iframe width="1024" height="768" src="http://www.bbc.com" style="-webkit-transform:scale(0.5);-moz-transform-scale(0.5);"></iframe>
查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-02-23 10:34

If you don't have access to the iframed site itself, then there's very little you can do since you can't access iframe from other domains with Javascript.

However, if you are able to change the external page, you could either pass a URL parameter or try CSS3 media queries. For the URL parameter you would simply include a secondary stylesheet if the parameter was present that changed the layout or reduced the size of the web page in some way.

查看更多
甜甜的少女心
4楼-- · 2019-02-23 10:39

It's impossible to scale entire web sites programmatically, whether in an iframe or not.

You would have to take a screen shot of the embedded page on server side, resize that and serve it as an image.

查看更多
Explosion°爆炸
5楼-- · 2019-02-23 10:40

The website would have to be uncommonly small to fit those dimensions.

<iframe src="http://www.google.com" width=200px; height=150px;></iframe>
查看更多
甜甜的少女心
6楼-- · 2019-02-23 10:43

If you mean scale the website down to fit in that frame then you can't.

查看更多
登录 后发表回答