runcode
runcode

Reputation: 3643

Rails Javascript pop up new windows

How can I make javascript open a new window combine with mailto: in Rails ?

right now , I have a link

= mail_to @receiver.email, "SEND TO #{@receiver.name}",:subj=>@receiver.subj,
:body=>@receiver.msg

But if the user click on this link, it will change the current windows's view. So I want to let the user click on the link , and a new windows opens up, and connect to user's mail applications, like gmail in browser..

How to acheive that?

one more question, If I know how to make the pop up windows, and how to make the view "click" on the mailto itself , without user click it?

Upvotes: 0

Views: 185

Answers (1)

David
David

Reputation: 7303

Add :target => '_blank' to your link:

= mail_to @receiver.email, "SEND TO #{@receiver.name}",:subj=>@receiver.subj, :body=>@receiver.msg, :target => '_blank'

For your second question, you can assign a class to the link :class => 'clickable' and trigger it like this (jQuery example)

$('.clickable').trigger('click');

Upvotes: 1

Related Questions