APIs & Integrations

dkapo
Member

How do I make a pdf open in a new tab instead of inside of the frame?

SOLVE

I want the user to receive a pdf after they fill out a form, but my issue is that the pdf opens inside of the iframe rather than taking up the entire screen or opening in a new tab. 

 

Here is the link:

https://masspaysolutions.com/hr_risks/

 

If you fill out the form you will notice the pdf remains inside. How do I get it to open in a new tab?

 

Thank you. 

0 Upvotes
1 Accepted solution
lscanlan
Solution
HubSpot Alumni
HubSpot Alumni

How do I make a pdf open in a new tab instead of inside of the frame?

SOLVE

Hi @dkapo,

 

It looks like you're iframing in a page that has the form embed code on it. So on your page here: https://masspaysolutions.com/hr_risks/, rather than adding the form's embed code itself, you're iframing in https://www.masspaysolutions.com/hubspot-hr-risks-form, which has the embed code. Is there a reason you're doing it this way? Because if you submit the form on https://www.masspaysolutions.com/hubspot-hr-risks-form, it redirects the top-level page (and not just the page inside the iframe) to the redirect URL, which in this case is the pdf file. So I think if you just add the form embed code to your page, instead of iframing in a different page that has the form, you'll redirect the top-level page to the pdf URL instead of just within the iframe.

 

As for why the iframe inside the iframe is redirecting only within the iframe, I'm not really sure. We can look into that (or maybe someone else here knows off-hand). But I just wanted to double check that you're doing that by design.

 

Leland Scanlan

HubSpot Developer Support

View solution in original post

0 Upvotes
2 Replies 2
lscanlan
Solution
HubSpot Alumni
HubSpot Alumni

How do I make a pdf open in a new tab instead of inside of the frame?

SOLVE

Hi @dkapo,

 

It looks like you're iframing in a page that has the form embed code on it. So on your page here: https://masspaysolutions.com/hr_risks/, rather than adding the form's embed code itself, you're iframing in https://www.masspaysolutions.com/hubspot-hr-risks-form, which has the embed code. Is there a reason you're doing it this way? Because if you submit the form on https://www.masspaysolutions.com/hubspot-hr-risks-form, it redirects the top-level page (and not just the page inside the iframe) to the redirect URL, which in this case is the pdf file. So I think if you just add the form embed code to your page, instead of iframing in a different page that has the form, you'll redirect the top-level page to the pdf URL instead of just within the iframe.

 

As for why the iframe inside the iframe is redirecting only within the iframe, I'm not really sure. We can look into that (or maybe someone else here knows off-hand). But I just wanted to double check that you're doing that by design.

 

Leland Scanlan

HubSpot Developer Support
0 Upvotes
dkapo
Member

How do I make a pdf open in a new tab instead of inside of the frame?

SOLVE

The only reason I was using iframe was because the previous code was written that way. This worked great, thank you! 

0 Upvotes