styling “<object>” tag inner content [duplicate]

情到浓时终转凉″ 提交于 2019-11-28 13:03:36

问题


suppose we have

<html>
  <body>
  <object width="435" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/SkPqgvQg3Mg"></object>
  </body>
</html>

so after the youtube video gets loaded onto html page we get a new html page inside if we inspect element onto the video.

Now i want to style the inline html inside the object tag.
is there any way to do it??


回答1:


Short answer: no.

There is no way to do what you want with CSS included in your page because CSS only applies inside document boundaries.
And you can't circumvent this with JavaScript either, by dynamically inserting stylesheets inside the object's (/iframe) content, due to the same origin security policy, which prevents you from affecting the content of an embedded document that is on a different domain as your container page.
The kind of vulnerabilities that this security policy prevents are called cross-site scripting vulnerabilities.




回答2:


-EDIT-

I think it would be best to use iframe,not object,since it's deprecated as of January 2015

SOURCE

As for changing the css I don't think it's possible for files from other sites



来源:https://stackoverflow.com/questions/42063330/styling-object-tag-inner-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!