# Rederded partial in iframe is adopting its parent page's hea

**URL:** <https://www.ruby-forum.com/t/rederded-partial-in-iframe-is-adopting-its-parent-pages-hea/128008>\
**Category:** Rails\
**Created:** [February 4, 2008, 6:42am UTC](https://www.ruby-forum.com/t/rederded-partial-in-iframe-is-adopting-its-parent-pages-hea/128008 "2008-02-04T06:42:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![isea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/dfb087/32.png) [@isea](https://www.ruby-forum.com/u/isea)\
**Post date:** [February 4, 2008, 6:42am UTC](https://www.ruby-forum.com/t/rederded-partial-in-iframe-is-adopting-its-parent-pages-hea/128008/1 "2008-02-04T06:42:49Z")

</div>

Hello,

I have an iframe in my page that for some reason is rendering all of the  
code from the parent page. Basically what I have going is the parent  
page with its wrapper and header and all that just getting repeated with  
in the iframe even though all the those divs are not explicitly coded in  
to the iframe. Hope that makes sense.Below is any relevant code.

iframe

```auto
<iframe SRC="<%= url_for :action => 'file_add', :id => @vari%>"
FRAMEBORDER="0" WIDTH="100%" HEIGHT="10" ONLOAD="this.height =
Math.max(this.contentWindow.document.body.offsetHeight,this.contentWindow.document.body.scrollHeight,this.contentWindow.document.documentElement.offsetHeight,this.contentWindow.document.documentElement.scrollHeight);">TODO:
no-iframes file uploader</IFRAME>
```

partial - I tried wrapping it in empty html to remedy this but that  
didn’t work

```auto
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
   <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
 </head>
 <body>
 <% form_tag({:action=> 'file_add', :id => @proof.id}, {:multipart =>
true}) do %>
   <%= hidden_field 'vari', 'id' %>
   <label for="file">Add:</label>
   <%= file_field_tag 'file', 'onChange' => 'this.form.submit();' %>
   <%= submit_tag "Add" %>
 <% end %>

 <UL>
 <% @vari.files.each { |file| %>
   <LI><A HREF="<%= url_for :action => 'file', :id => @vari, :file_id =>
file.id, :name => file.name %>"><%=h file.name %></A> from
     <%=h case file.belongs_to
       when 'requester' then @vari.requester.displayName
      when 'subject' then @vari.subject.displayName
       when 'sender' then @vari.subject.displayName
       when 'author' then @vari.author.displayName
     end %></LI>
<% } %>
</UL>
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![isea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/dfb087/32.png) [@isea](https://www.ruby-forum.com/u/isea)\
**Post date:** [February 25, 2008, 8:48pm UTC](https://www.ruby-forum.com/t/rederded-partial-in-iframe-is-adopting-its-parent-pages-hea/128008/2 "2008-02-25T20:48:16Z")

</div>

Its probably picking up your application layout code (app/views/  
layout).  
You’ll need to render without the general layout.

---

<div class="post-metadata">

**Author:** ![isea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/dfb087/32.png) [@isea](https://www.ruby-forum.com/u/isea)\
**Post date:** [February 25, 2008, 8:53pm UTC](https://www.ruby-forum.com/t/rederded-partial-in-iframe-is-adopting-its-parent-pages-hea/128008/3 "2008-02-25T20:53:00Z")

</div>

i.e in the controller, do a render(:layout=\>some\_new\_layout)
