最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Styling iframe content - Stack Overflow

programmeradmin3浏览0评论

Is there any possibility to style iframe content ?

I am working on Google integration and including iframe with document.

<iframe src=""></iframe>

This google document has Menu(File, Edit ...) which i dont want to be displayed. Is there any possibility to target this elements and give them attributes such as . Display:none ? Or simply hide this elements somehow ?

Thanks !

Is there any possibility to style iframe content ?

I am working on Google integration and including iframe with document.

<iframe src="https://docs.google./document/d/1FXbO5XkM5jIcvkqNTEu2EoxmU9UmlyLaa8NPmlcQW1M"></iframe>

This google document has Menu(File, Edit ...) which i dont want to be displayed. Is there any possibility to target this elements and give them attributes such as . Display:none ? Or simply hide this elements somehow ?

Thanks !

Share asked Apr 25, 2012 at 18:30 collin.skcollin.sk 551 silver badge6 bronze badges 1
  • I would have to go with No, it is not possible unless the iframe is being included into a document that exists on the docs.google. domain. – Kevin B Commented Apr 25, 2012 at 18:34
Add a ment  | 

3 Answers 3

Reset to default 4

well, as you said somehow,

you could try:

<div id="trick">
   <iframe/>
</div>

#trick{
   overflow:hidden; /* you will have to play a bit with heights and widths*/
}
#trick iframe{
   position:absolute; /*or relative. depending on your markup*/
   top:-90px /* Asuming the menu you want to hide is that height */
}

'Seems' to do the job: http://jsfiddle/Tey5f/3/

or you could:

$('iframe').contents().find('head').append('rel="stylesheet" type="text/css" href="myChanges.css" />');

There's no way to apply styles to an external site like Google Docs, cross-domain prevention.

It's not possible. However, you could use proxy to load google's content :) Once you configured your server side to proxy such request just replace googles urls with something like this:

http://yoursite./googleproxy/document/d/1FXbO5XkM5jIcvkqNTEu2EoxmU9UmlyLaa8NPmlcQW1M

But there may be problems with the content linked by that googles page, because now requests to docs.google. are cross-domain.

发布评论

评论列表(0)

  1. 暂无评论