I've a vf page rendered as pdf which has to be downloaded on click of a button. This button has to be present on detail page of 3 objects: Account, Contact and Opportunity. To support 3 objects, a generic custom controller is written and the button is made a URL type, being opened in existing window. I've added 'content-disposition' through apex to download the page.
The problem is, on click of the button the page goes to a blank screen and the pdf gets downloaded. Is there a way that on button click the pdf gets downloaded and the window stays on the record page without directing to blank screen (or anywhere else)?
Please see attached screenshots of the button and its behaviour.