Example HTML code for opening a PDF file in a new browser window.
When creating a link to a PDF file, you can use the HTML <a> tag with the target=”_blank” attribute. This instructs the browser to open the link (pdf) in a new window or tab.
Here’s an example of what the HTML code might look like:
<a href=”URL_OF_YOUR_FILE.pdf” target=”_blank”>Open PDF in New Window</a>
**Sometimes, whether a PDF opens in the browser or downloads the file can depend on the user’s browser settings. If that is happening for your users, an option would be to embed the PDF file on the actual page you show to the users.
The URL link below links to a PDF file named Groundwater-Rights-Summit-2023b.pdf in the media library. By default, this should open in a new window.Groundwater Rights
Below is a button example with the same file. Note that the link options from the elementor edit Button Widget has the “open in new window” checked.