How can I show documents from the web that require authentication?

I have documents to show. Mostly PDF. But also others, jpg, xlsx, ods, ... (depending on the system).
In my VCL application I use the EdgeBrowser. I can put an auth header there.

How do I do that in web core?

With TWebBrowserControl I don't know how to set the header.
And with the TTMSFNCWebBrowser I can't get it to work at all.

Is there an example?

You could use Form.Navigate() to let a new browser tab open these specific files from an URL.

No I did not mean that.

  1. The documents should be inside my form
  2. Authentication is required for the URL (bearer token), otherwise I won't get the documents)

(I'm currently studying "Postman" to see how this works. With Postman you can do exactly that. I think every application that wants to display documents needs this.)

I use this in a VCL application. That works fine.
I thought it was even easier on the web.

At this moment, it isn't possible to set headers for TWebBrowserControl.
I found a technique described here to include the headers in the URL:

Ok, I wil try it.

But, do you have an example for the TTMSFNCWebBrowser? I only find this component in VCL (component palette), but not in Web Core. I have tried with add the unit manually. But I couldn't get it to run that way.

TTMSFNCWebBrowser does not support in TMS WEB Core. There is already the TWebBrowserControl.

Ah ok. I thought because it says in the manual.

II try to get the document's data normally via XData and then give it to the browser as Base64 data. Maybe that will lead to success.

Or I'm looking for a web document viewer component on the internet.

I documented this via a blog:

1 Like

:+1:

Thank you.

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