Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Courses Plus Student 6,044 Points

Urgent Issue! How do I open link from modal in a new window?

I have a modal that contains a button link. Once clicked, this should open a new window with pdf content.

What is happening is that the link is opening on the same page and the PDF that is loaded is offset - shifting down and to the right of the page.

Urgent help is much appreciated!

2 Answers

Gurpeer Duhra
Gurpeer Duhra
4,205 Points

Can you provide the code ? that way we can find out what is wrong.

Erik Nuber
Erik Nuber
20,629 Points

You need to target a blank window within your pdf link

<a href="yourfile.pdf" target="_blank">Some Text Here If You want</a>

if you are looking to do this with a button you need to use javascript

<button class="button" onClick="window.open('http://www.site.com', "_blank");"><span class="icon">Open</span></button>