tableau / extensions-api

Extensions API sample code and developer docs.
http://tableau.github.io/extensions-api
MIT License
268 stars 251 forks source link

How do I open a url from Tableau Extension on Tableau Desktop? #201

Closed owlstack closed 2 years ago

owlstack commented 5 years ago

I have a web app that I've connected to a Tableau Extension and it contains a href link on the front page.

<div class="row">
       <a href="http://localhost:8080/download/file.pdf" target="_self">Download</a>
</div>

The issue I'm having though is, when I click directly on the url in Tableau Desktop (after I add the Tableau Extension to Tableau Desktop), it doesn't launch a new tab or new window to open the hyperlink. Like nothing happens.

What should I be doing to get it to launch?

johnDance commented 5 years ago

Hello If I try to duplicate exactly what you have, I get the following message in my console: Resource interpreted as Document but transferred with MIME type application/pdf

I can open it in a new window like this: Download

I can open HTML in _self, but not the PDF.

If you have already tried _blank, or loading HTML, and you have your extension hosted on an https server, you will need to serve the HTML/PDF from https also.

Let me know if any of those suggestions works for you. John

LGraber commented 5 years ago

Hi ... let us know if this worked for you so we can close this out or provide other pointers. Thanks

luukvnes commented 5 years ago

What worked for us was instead of < target="_self"> this opes a new page in the default browser where the file is downloaded.

romanlegeza commented 3 years ago

It works only with Cmd+Click. Is there any way to to just a click to open a url?

KeshiaRose commented 3 years ago

Can you share the exact version of Tableau you're using and your operating system?

One thing that I can think of that might cause this (at least from the original post) is that the file was being served on HTTP while perhaps the extension was on HTTPS. If that is the case you'll likely see an error similar to this in the console. Mixed Content: The page at 'xxxxxxxx' was loaded over HTTPS, but requested an insecure resource 'http://localhost:8080/download/file.pdf'. This request has been blocked; the content must be served over HTTPS. Other than that, this should definitely work.

romanlegeza commented 3 years ago

@KeshiaRose we are using Tableau Server Version: 2020.3.8 (20203.21.0413.0840) 64-bit Linux and Tableau Desktop 2020.3.5 on MacOS I implemented a simple extension with a link like <a href="http://google.com" class="btn btn-lg" target="_blank"> And it opens a url only if I do Cmd+Click.

KeshiaRose commented 3 years ago

Strange, I copied your example and it worked for me both in Desktop 2020.3.5 on mac and Server 2020.3.11 on Linux. Can you try out this sample extension and see if any of the links open for you without cmd+click? Also, did you see any errors in the console when you tried to click it?

romanlegeza commented 3 years ago

wow, this works great! just by click

romanlegeza commented 3 years ago

oh I see, mine is a Sandbox extension. I just changed it to a Network one and it started working. Is it a sandbox restriction?

KeshiaRose commented 3 years ago

Aha! Yes, that is a key detail! External links are not allowed in sandbox extensions.

romanlegeza commented 3 years ago

Thanks @KeshiaRose for clarification! qq then: is there any way to replicate Navigation Buttons inside an extension? to be able to navigate inside the workbook between dashboards

KeshiaRose commented 3 years ago

No unfortunately not, 🙁.

bcantoni commented 2 years ago

Closing this one as resolved. Keshia's comment is the key here: external links are not allowed in sandboxed extensions.