2

I've been killing myself for the past 2 days trying to do 2 things:

  1. Create an iframe with content from another domain that will auto resize to the length of the content in the iframe
  2. ~and most importantly~ Apply css styles to the content [from the external domain] in that iframe.

I've explored the jQuery stuff, and found no 'reliable' love, the 'frameReady()' plugin seems to have disappeared ... I'm not sure what to do - or even if this is the best way.

So; is there a better and more reliable way to get this accomplished? I have full access to the server so .htaccess/php/cgi - even including a conf for apache [linux!] is possible. One thing to note is that one of the frames is a booking system that needs to pass data back and forth. [well technically so is the other frame....]

-thanks -sean

4

2 回答 2

1

IFRAME 在技术上是另一个窗口,因此外部窗口的 CSS 不能应用于带框架的 HTML 文档中的 HTML。

自动调整大小是可能的,只要窗口之间允许通信,但我不确定这是可靠的跨域,尤其是跨浏览器。如果两个窗口都在同一个域上,那么是的。另一种选择是滚动条,它们并不那么邪恶。

预订系统可以称为服务器端并在您的页面中重新提供服务,但如果您试图包含预订系统的交互性,这也是一个很大的痛点。我不知道您可以使用任何可以为您执行此操作的软件包。

我倾向于坚持使用 IFRAME 并致力于为预订系统贴上白标,以便在 IFRAME 内更好地呈现它。除非您不是说您可以完全访问预订系统的服务器,在这种情况下,如果预订系统没有为此提供专门的 API,您将会遇到困难。

您将不得不重写其内容并通过您的服务器传输交互性,就像代理一样,或者可能类似于 skyscanner.net 和混淆.com 所做的事情。

于 2011-01-26T22:46:16.427 回答
0

You might want to read this post and then check out Porthole.js:

http://shouldersofgiants.co.uk/Blog/post/2009/08/17/Another-Cross-Domain-iFrame-Communication-Technique.aspx

Porthole: http://ternarylabs.github.com/porthole/

于 2011-10-17T20:05:28.010 回答