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¶m2=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!
精彩评论