如何使iframe中的内容具有响应性? [英] How to make the contents inside an iframe responsive?

查看:210
本文介绍了如何使iframe中的内容具有响应性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从某个网站嵌入了一个播放器,该播放器使用iframe播放频道.我能够使iframe响应.但是,iframe内的内容(即视频播放器)无法适应视口中的更改.我已经尝试了几种来自Internet的解决方案,但所有解决方案都使iframe响应,但内部内容却没有响应.

I have embedded a player from a site which streams a channel using an iframe. I am able to make the iframe responsive. But the content i.e the video player inside the iframe is not adaptive to the changes in viewport. I have tried several solutions from internet but all of them make the iframe responsive but not the content inside.

有什么方法可以使iframe中的视频播放器响应?

Is there any way I can make the video player inside the iframe responsive?

请注意,我无权访问播放器的源代码.

Please note that I don't have access to the source code of the player.

以下是指向html文件的链接: IFrame代码 (我无法为此创建一个有效的提琴.因此,请共享文件)

Here's the link to the html file: IFrame Code (I was not able to create a working fiddle of this. So shared the file instead)

推荐答案

请注意,我无权访问播放器的源代码.

Please note that I don't have access to the source code of the player.

您遇到了麻烦

处理iframe时要了解的一件事是iframe的来源

The one major thing to know while dealing with iframe is the source of the iframe

  • iframe源具有与该iframe呈现相同的与主页相同的域:在这种情况下,浏览器将允许您动手操作iframe内容并根据需要进行操作.由于主站点和iframe都在同一个域中,这意味着您是授权人,因此可以根据需要更改内容.

  • iframe source has the same domain as the main page which renders this iframe: In this case the browser will let you put your hands on the iframe contents and manipulate it as desired. As both the main site and the iframe are unders same domain it means you are a authorized person so you can change the contents if required.

因此,即使您无权访问文件的源代码,如果内容位于同一域中,仍然可以使您的内容具有响应性. This would require Jquery

So even if you don't have access to the source code of the file there are still way's to make your contents responsive if they are in the same domain. This would require Jquery

iframe源域与呈现此iframe的主页不同:在这种情况下,除了在页面中显示iframe之外,您无法对其进行任何其他操作.浏览器不允许您更改此iframe上的任何内容.这是所有浏览器都遵循的安全协议.

iframe source domain is not the same as your main page which renders this iframe: In this case you cannot do much with the iframe except displaying it in your page. The browser will not allow you to change any stuff on this iframe. This is a security protocol followed in all the browsers.

  • 如果完全可以访问我们的内容,会发生什么情况-例如:我可以在网站的iframe中渲染youtube,并将字符串"youtube"的所有实例更改为我自己的名称,从而使整个网站看起来像我自己的.我还可以操纵ajax调用,jquery内容等,并从站点获取数据.

这篇关于如何使iframe中的内容具有响应性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆