I have a rails app with content other websites need to access via iframe. The content should have a different layout when shown on the websites (no menu bar etc.) I made a new layout file called iframe.html.erb How can I check, whether the page is called form an external iframe so the right layout file is used?
As far as I know when you doing
<iframe src="www.google.pl"></iframe>
you have no control over layout or styles of page display in iframe unless you own the page and can make it look whatever you like.
EDITED
If you displaying your own site go like this:
<iframe src="/some_site_that_i_can_change_code_in?from=iframe"></iframe>
and then in controller of some_site_that_i_can_change_code_in:
if params[:from] == "iframe"
render :layout => "for_iframe"
else
render :layout => "normal"
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With