English 中文(简体)
1. 纵向扩大DIV, 包括iFrame
原标题:Expand DIV vertically that contains an iFrame

http://jsfiddle.net/fJkBU/1/"rel=“nofollow> http://jsfiddle.net/fJkBU/1/

这符合我的法典。 基本上,我有一个框架,其来源可能发生变化。 我需要装有DVD,以垂直方式扩大,使iFrame内的任何东西都符合要求。

我可以让它工作。 任何想法?

http://www.ohchr.org。

<!DOCTYPE html>
<html>
  <head>
    <title>Ruby on Rails: Welcome aboard</title>
  </head>
  <body>
    <div id="page">
      <div id="content">

        <div id= commentLoader  style="width: 500px;">
            <iframe id="commentIframe" src="http://www.amazon.com" style="border-style: none; width: 100%; height: 100%"></iframe>
        </div>
      </div>
    </div>
  </body>
</html>
最佳回答

All the other methods will not work, because...

......Mozilla (和所有其他主要浏览器,见paislee s comment) ,称,“Same Origin Policy” 声明:

The same origin policy prevents a document or script loaded from one origin from getting or setting properties of a document from another origin.

基本上,Caper确保你不能再访问另一个网页,展示 properties的特性,因为这将是一种安全危险(对于 co具的劫持和我相信的这种危险)。


例如,这里是similar question在讨论同一页的iframe时;这里是

Ok,因此,你现在有两种选择,即你知道你可以接触一机高th(,因为它位于另一个领域):

  1. Change it so you do control the contents of the iframe (then either put it under the same domain or use the solution posted in the similar question).
  2. 假设1,你不可能利用服务器进入网页。 这里的第一项选择是,对iFrame的内容进行筛选,然后展示。

    • If you aren t up for writing a screen scraper you could use a proxy script and then display an iframe of your proxy (hosted on the same server); this would permit you to access the site as if it we re your own and the user would notice no difference (Note: I m pretty sure this is against all terms of service/possibly illegal as the user could try to interact with the website (unaware it is loaded thru a proxy) in the iframe (i.e. login)... and you would effectively be phishing)
  3. 我假定,在座标上装上的东西是一套评论(放弃这种评论的类型),我也认为,假定每项评论都有固定的高度或最高高度。 如果有的话,你可以撰写一个装上页的网址的文字,计算出评论(栏)的数量,然后乘大号,通过评论高确定iframe的适当高度。

Good luck,

问题回答

你们的伤口最多只能是窗口的大小,而不是内容的高度。 而且,正如你似乎想要扩大,为什么不只是从一开始就使窗口达到100%的高度?

我不敢肯定,我得到100%的答复,但如果你想要一个集装箱,由于你能够使用jquery ajax 。 当你在其中装满内容时,就会产生新的高度。 给予这种灰.,并且你能够放弃一个充满活力的 height升。 基本上,你将翻一番,把它放在你身上。

• 寻找交叉主轴。 我过去曾使用过这个词,但却是徒劳的!

在Ipi onload活动上接下以下的Javascript功能。

function autoResize(id)
    {
    var newheight;
    var newwidth;

    if(document.getElementById){
        newheight=document.getElementById(id).contentWindow.document.body.scrollHeight;
    }
    document.getElementById(id).height= (newheight) + "px";
}

e.g:

<iframe id="commentIframe"  onload="autoResize( commentIframe )" src="http://www.amazon.com" style="border-style: none; width: 100%; height: 100%"></iframe>

You ve got single quotes around your CSS id. Replace them with double quotes like the rest of your code.

变化:

id= commentLoader 

:

id="commentLoader"




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签