In my application, I need one requirement that, when clicking on a link, it will open into a new window. But I am confused how I can do using link_to ( Url helper tag, which is used in Symfony). After searching it on Google I got the answer. Might be look like simple, "popup"=>"true"; this is the code that we have to add on the link_to. And also I would like to share some additional URL helper informations in this Post. Hope that this will useful for some one..
Options
- :confirm => 'question?' - This will add a JavaScript confirm prompt with the question specified. If the user accepts, the link is processed normally, otherwise no action is taken.
- :popup => true || array of window options - This will force the link to open in a popup window. By passing true, a default browser window will be opened with the URL. You can also specify an array of options that are passed-thru to JavaScripts window.open method.
- :method => symbol of HTTP verb - This modifier will dynamically create an HTML form and immediately submit the form for processing using the HTTP verb specified. Useful for having links perform a POST operation in dangerous actions like deleting a record (which search bots can follow while spidering your site). Supported verbs are :post, :delete and :put. Note that if the user has JavaScript disabled, the request will fall back to using GET. If you are relying on the POST behavior, you should check for it in your controller’s action by using the request object’s methods for post?, delete? or put?.
- The html_options will accept a hash of html attributes for the link tag
Quite useful
ReplyDelete