Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

UNC path is misinterpreted in procedure TChromium.LoadURL

Post Reply
lindor
Posts: 2
Joined: Thu Feb 24, 2022 12:36 pm

UNC path is misinterpreted in procedure TChromium.LoadURL

Post by lindor »

Hello.
I'm using the latest CEF4Delphi on Tokyo 10.2.3 and I have a problem with the
<<procedure TChromium.LoadURL(const aURL : ustring; const aFrameName : ustring = '')>> once the HTML file is in the network, e.g. "\\t-sw19-ts.com\Data\XXX\HTML_Dialogs\Viewer3d.html".
If UNC path is connected to a network drive, then I can map that and it works correctly. If UNC path is not connected to any network drive, then the UNC path is interpreted incorrectly. I prepare the UNC path and then send along as "file://///t-sw25-ts.com/Data/XXX/HTML_Dialogs/Viewer3d.html" parameter.
Image
After OnLoadEnd handler I see in ICefFrame record that ICefFrame .URL was changed to " file://t-sw25-ts.com/Data/XXX/HTML_Dialogs/Viewer3d.html".

Image As a result, the object is not loaded in 3-D Viewer.
Why are the "//" of the URL truncated, can I suppress this if the URL is a UNC path?

kind regards
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: UNC path is misinterpreted in procedure TChromium.LoadURL

Post by salvadordf »

Hi,

Build the MiniBrowser demo and click on the top-right button with 3 lines. Then select the "Open a file with a FILE URL..." option.

Select your HTML file from the network folder (not the mapped unit) and click the Ok button.

I just did all this and it worked fine but the generated URL has only 2 "/" characters.

MiniBrowser only added "file:///" to the original path and CEF removed some "/" automatically.
As far as I know, there's no way to disable this feature.

Chromium limits what you can load with FILE URLs for security reasons. Perhaps this issue is caused by this.
If this is the case I would try to register a custom scheme to load files without security problems.

Try registering "http" or "https" as if they were a custom scheme to load those files. See the SchemeRegistrationBrowser demo for all the details.
lindor
Posts: 2
Joined: Thu Feb 24, 2022 12:36 pm

Re: UNC path is misinterpreted in procedure TChromium.LoadURL

Post by lindor »

Hi,
thanks for the quick reply. Yes, you are right, the problem is probably because the file URL and the Chromium application were in different network environments. I will follow your recommendation and find a suitable solution in the SchemeRegistrationBrowser demo.

kind regards
Post Reply