开发者

Rails + iframe: Rendering another website in your rails application

I would like to render another website i开发者_StackOverflown my rails application. The html tag < iframe> seems to the this as I want. I was wondering how I could make this as smooth as possible. Do I need to make a new model? How do I pass parameters to the website I would like to render?

Thanks


If you use an iframe, you'll only have minimal control of the page you render. You can pick the URL, and pass any params it takes by appending them to the URL itself. But anything requiring login / cookies / etc. will need to be done by the user - you can't set cookies for other sites, for obvious security reasons.

<iframe src="http://www.othersite.com/some/path?param1=value1&param2=value2">
    <p>Placeholder text; only shows up if the page DOESN'T render!</p>
</iframe>

That's a simple example, but it covers just about all iframes can do for you. If that's all you need, perfect, but if not, you're going to have to do something much more complex.

Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜