Jump to content
Sign in to follow this  
ChrisChuah

Delphi 10.4.2 TWebBrowser navigate URL

Recommended Posts

Hi

In Delphi 10.4.1, when the Win64 program called WebBrowser1.Navigate("file://z:\filename.pdf") where z drive is a shared drive, it will display the pdf in the Browser.

However, when i upgraded to 10.4.2, the same function will prompt for File Download.

I also tested to navigate a C drive pdf document and it will also prompt the file download

Please help

 

====== source =========

procedure TForm1.Button1Click(Sender: TObject);
var
 l_filename : string;
begin
  if OpenDialog1.Execute then begin
    l_filename := OpenDialog1.FileName;
//    l_filename := 'file://' + l_filename;
    WebBrowser1.Navigate(l_filename);
  end;
end;

======= End ================

 

regards

chris

Screenshot 2021-03-06 at 17.26.04.png

Screenshot 2021-03-06 at 17.25.47.png

Edited by ChrisChuah

Share this post


Link to post
Guest
6 hours ago, ChrisChuah said:

However, when i upgraded to 10.4.2, the same function will prompt for File Download.

look in your Edge Browser, or, current browser by default, the options about "download" some file-type, like pdf.

some files, is not allow to be showed, but, to be downloaded by default.

 

hug

Share this post


Link to post

hi

Previously it was chrome as a default but i set to Edge Browser.

However, i could not find anything about download on file type in Edge Browser.

something related to mime type?

 

regards

chris

Share this post


Link to post
Guest

email45x is trying to point out that this is a browser setting.

If you cannot identify how to change that setting over the command line then you will need to find another approach.

If this is software only you will be using (a tool or some such) change settings in your browser, not in your program.

If it is production software you will need to add some kind of instruction of browser-selection and setup.

IMHO a browser is not the best way of showing PDF:s, browsers change the implementation often.

Also PDFs are a sizeable attack vector (scripted files).

Share this post


Link to post

The "Navigation to web page was cancelled" indicates that this rendered by Internet Explorer. You either had an internet explorer plug-in for rendering PDFs (like Adobe Reader), or you had your TWebBrowser set to use Edge instead of Internet Explorer. Edge displays PDFs flawlessly with no external dependencies.

Edited by Der schöne Günther

Share this post


Link to post
Guest
On 3/6/2021 at 5:41 AM, ChrisChuah said:

I also tested to navigate a C drive pdf document and it will also prompt the file download

look if help in some:

image.thumb.png.8a51a706a630f66c3e4562ac00db1d36.png

 

hug

Share this post


Link to post

Hi

So sorry for the late reply

actually, its the problem with Adobe Acrobat with Internet Explorer.

I have to uninstall and re-install Adobe Acrobat again.

seems like that solve my problem.

 

regards

chris

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×