The fragment (anchor #) in .NET 4 WebBrowser Control is lost using Adobe PDF Reader and the file: //

I am creating a URI with a fragment (aka anchor #).

UriBuilder ub = new UriBuilder("file://path/doc.pdf");
ub.Fragment = "chapterX";

The url is displayed correctly in the debugger (ub → file://path/doc.pdf#chapterX). But when I assign it to the WebBrowser control, part of the fragment is lost (for the reason for the fragment, see the PDF Open parameter ).

this._myWebBrowser.Url = ub.Uri;
// Alternative this._myWebBrowser.Navigate("file://path/doc.pdf#chapterX");

When I check this._myWebBrowser.Url, it displays file://path/doc.pdf. this._myWebBrowser.Url.Fragmentempty - also readonly and cannot be assigned.

As shown in Figure C. Haas, the concept works as a whole, for some reason it fails when the resource is a LOCAL (!) Pdf file.

Summary:

  • Works if the http protocol
  • It works if the resource is -.htm / .html - even if the protocol is a file: //
  • Works if the file is .pdf and the protocol is http (same as 1.)
  • , pdf,

?


:

  • 20110219 - C.Haas. , ".htm", ".pdf", .
  • 20110218 - : Navigate, , Navigate . IE ( ), URL- . , , , URL , , , .
+2
1

wb.Navigate("http://example.com#chapterX");

?

+1

Source: https://habr.com/ru/post/1723987/


All Articles