# Loading yield within an Iframe

**URL:** <https://www.ruby-forum.com/t/loading-yield-within-an-iframe/179414>\
**Category:** Rails\
**Created:** [November 24, 2009, 2:43pm UTC](https://www.ruby-forum.com/t/loading-yield-within-an-iframe/179414 "2009-11-24T14:43:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prionko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@prionko](https://www.ruby-forum.com/u/prionko)\
**Post date:** [November 24, 2009, 2:43pm UTC](https://www.ruby-forum.com/t/loading-yield-within-an-iframe/179414/1 "2009-11-24T14:43:14Z")

</div>

Hi All,

Im building an application in RoR. The client wants to put the main  
content inside an iframe. By main content I mean, the contents which  
gets displayed by the calling yield inside application.html.erb file.

Currently Im having this code

\<%=yield%\>

But what i want to do is something like this:

and Im not understanding where or how can I put the \<%=yield %\>.

Can anybody give me some idea on how to proceed from this point ?

I need this solution urgently.

Hoping to here soon.

Thanks,  
Saurav

---

<div class="post-metadata">

**Author:** ![prionko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@prionko](https://www.ruby-forum.com/u/prionko)\
**Post date:** [November 25, 2009, 2:02am UTC](https://www.ruby-forum.com/t/loading-yield-within-an-iframe/179414/2 "2009-11-25T02:02:35Z")

</div>

Saurav C. wrote:

> Hi All,
> 
> Im building an application in RoR. The client wants to put the main  
> content inside an iframe. By main content I mean, the contents which  
> gets displayed by the calling yield inside application.html.erb file.

Why are you letting you’re client dictate technical design to you?  
What’s your job if he’s making all the technical decisions?

> Currently Im having this code
> 
> \<%=yield%\>

Using tables for layout is not looked upon very well in modern web  
design.

> But what i want to do is something like this:

iframes, although might be occasionally necessary, are also frowned upon  
these days. If you don’t absolutely need one then DON’T use it! Use a

 with the proper CSS overflow instead. Then your yield issues becomes instantly irrelevant. You'll have a better design, and your peers won't turn their noses up at you code.

---

<div class="post-metadata">

**Author:** ![prionko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@prionko](https://www.ruby-forum.com/u/prionko)\
**Post date:** [November 25, 2009, 3:26am UTC](https://www.ruby-forum.com/t/loading-yield-within-an-iframe/179414/3 "2009-11-25T03:26:19Z")

</div>

Thanks for the reply Robert. I agree with your point, but the matter of  
fact is I have to implement it that way. Any suggestion on how can i  
solve this ?

Thanks,  
Saurav

Robert W. wrote:

> Saurav C. wrote:
> 
> > Hi All,
> > 
> > Im building an application in RoR. The client wants to put the main  
> > content inside an iframe. By main content I mean, the contents which  
> > gets displayed by the calling yield inside application.html.erb file.
> 
> Why are you letting you’re client dictate technical design to you?  
> What’s your job if he’s making all the technical decisions?
> 
> > Currently Im having this code
> > 
> > \<%=yield%\>
> 
> Using tables for layout is not looked upon very well in modern web  
> design.
> 
> > But what i want to do is something like this:
> 
> iframes, although might be occasionally necessary, are also frowned upon  
> these days. If you don’t absolutely need one then DON’T use it! Use a
> 
> with the proper CSS overflow instead. Then your yield issues becomes instantly irrelevant. You'll have a better design, and your peers won't turn their noses up at you code.

---

<div class="post-metadata">

**Author:** ![prionko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@prionko](https://www.ruby-forum.com/u/prionko)\
**Post date:** [November 25, 2009, 4:39am UTC](https://www.ruby-forum.com/t/loading-yield-within-an-iframe/179414/4 "2009-11-25T04:39:55Z")

</div>

Saurav C. wrote:

> Thanks for the reply Robert. I agree with your point, but the matter of  
> fact is I have to implement it that way. Any suggestion on how can i  
> solve this ?

Sorry. I haven’t ever thought about that since I wouldn’t consider doing  
it. The iframe is going to act independent of your current request  
context. Using \<% yield %\> is going to work within the current request  
context as far as I understand it. Hopefully others will be able to  
explain better.
