简体   繁体   English

是否可以在 2020 年在外部域 iframe 中进行样式设置?

[英]Is is possible to style in external domain iframe in 2020?

client push me to change the CSS styles of an external site which is included in an iframe.客户推动我更改包含在 iframe 中的外部站点的 CSS styles。 Is it possible to do that?有可能这样做吗? I found topics from 2011 with a solution, but after I tried to do that with CSS, js, jquery - I think is not possible if the site is not hosted by the same domain.我找到了 2011 年的主题并提供了解决方案,但是在我尝试使用 CSS、js、jquery 进行此操作后 - 我认为如果该站点不是由同一域托管,则不可能。

It's still not possible for security reasons.出于安全原因,这仍然是不可能的。 In order to allow this, you'd need control of both sites, and even then, you'd be potentially opening yourself up to allowing XSS attacks on the target site.为了实现这一点,您需要控制这两个站点,即使这样,您也可能会允许对目标站点进行 XSS 攻击。 Your best bet would see if the target site has an API that you could pull data from and display on your site with whatever styling you want.您最好的选择是查看目标站点是否具有 API,您可以从该站点中提取数据并以您想要的任何样式显示在您的站点上。 That's a separate topic altogether though.不过,这完全是一个单独的话题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM