Open attached pdf link in new tab after playing animation

I want to delay a link load to an attached PDF that opens in a new window tab.So I added this js code snippet to the project’s custom code:

The link to the pdf attachment:
`javascript:delay(‘https://uploads-ssl.webflow.com/myPDF_File.pdf’)

This works fine but the PDF will open in the same tab and closing the webpage. If I choose to open the link in a new tab the browser will block it and show “about:blank#blocked”

Anyone maybe a workaround that?

Thanks

Oliver

To open a link in a new tab, just set the target attribute to _blank

feel free to find more sources

That works, when you link to another page but I want to open a pdf attachment in another tab…

hi @oooooliver I do not know why you thing that is only related to pages as it is related to URL. When you add to PDF link target="_blank" it will open PDF in a new tab.

EDIT:
Video was deleted by me to save space on cloud storage

Thanks Stan
I understand that putting the target on _blank will open on another tab. What I want to achieve is to play an animation before loading the link to an attachment file on a separate tab. So this is JS:

This function is triggered when you click on the link block with the URL:
`javascript:delay(‘https://uploads-ssl.webflow.com/60ade6a757ca36321a84087a/61374fb1cdc72d60b3ee1341_Montageanleitung_smart_PLACE_Taster.pdf’)

but this will still will open on the same window/tab
This still will open the URL attachment on the same tab as the webpage.

hi @oooooliver what JS library you are using as

this code syntax is not familiar to me. Anyway, delay is in vanilla JS se by setTimeout

Can’t tell you which library it is: Got that code snippet here:
How to build page transitions in Webflow | Webflow Blog

hi @oooooliver I have found the way how to achieve your requested functionality. Hopefully you will be able to implement and make it work together with your animation.

Stan the man!

It worked with the window.open part! Didn’ t try that!
Thanks for your time and help!

1 Like

hi @oooooliver if you don’t have further question related to current topic feel free to close your request as solved.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.