To do this, you need to use JavaScript:
<script type="text/javascript"> window.name = "MyWindow"; </script>
Of course, you can easily pack this into the Rails helper method. For example, in app/helpers/application_helper.rb add a new method:
def window_name(name) content_for(:window_name) do "<script type=\"text/javascript\">window.name = \"#{name}\";</script>" end end
Then in your layout file, add this line somewhere inside the HTML <head> element:
<%= yield :window_name %>
Finally, in your view templates, simply add a line like this (maybe anywhere) to display the correct JavaScript:
<% window_name 'MyWindow' %>
source share