ruby on rails - send_data - open file in new browser window? -


#in controller (works fine)      order = order.find(params[:id])     url = order.receipt.file.url     data = open(url).read     send_data(data, type: 'application/pdf', filename: "appname-receipt#{order.id}", disposition: 'inline') 

this takes pdf stored in s3, , renders fine in current window.

just wondering if knows slick way open in new browser window?

the target attribute on anchor (<a>) elements can used open linked pages in new window.

<a href="#" target="_blank">i open in new window.</a> 

_blank: load response new unnamed html4 window or html5 browsing context. https://developer.mozilla.org/en-us/docs/web/html/element/a


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -