Can I redirect_to in a new window

I have a list of links that users can click. When the click is made, I want to increase the counter (to track how many users clicked this link), and then open the link in a new window.

Right now, in the show method method, I can do everything except the "new window" thing. Is there a way to achieve this in pure rails or do I need to do some additional javascript to run an ajax request (for increment) and then open the link in a new window?

thanks Pierre

+3
source share
3 answers

I would think that the easiest solution would be to simply link your link

target = "_blank"

,

+6

AJAX, javascript , javascript.

HTTP .

! , , hrefs, URL SEO!

!

0

Simple javascript can do:

    window.open('filename.php?var=' + varvalue, 'resizable=1, scrollbars=1, left=80,top=60, width=650, min-height=400');

If you use any jquery libraries, you can look at the modals.

I know how to do this in Rails.

-1
source

Source: https://habr.com/ru/post/1714506/


All Articles