send_data - open file in new browser window?

前端 未结 1 1627
南方客
南方客 2021-01-20 05:06
#in my controller (works just fine)

    order = Order.find(params[:id])
    url = order.receipt.file.url
    data = open(url).read
    send_data(data, type: \'appli         


        
相关标签:
1条回答
  • 2021-01-20 05:31

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

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

    _blank: Load the response into a new unnamed HTML4 window or HTML5 browsing context. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

    0 讨论(0)
提交回复
热议问题