Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

geraldpratt
PLUS
geraldpratt
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>