Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i redirect_to in a new window

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

Right now, in the 'show' method method, I can do all that except the "new window" thing. Is there a way to achieve this in pure rails or do I have to do put some additional javascript to launch an ajax request (for the incrementation) and then open the link in a new window?

thanks, Pierre

like image 391
Pierre Avatar asked Oct 22 '25 14:10

Pierre


1 Answers

I would think the easiest solution would be to just have your link contain

target="_blank"

The window would open, go to your counter page, and get redirected to the correct page

like image 157
John Avatar answered Oct 24 '25 05:10

John



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!