简体   繁体   中英

Specifying an IP Address in FireMonkey TWebBrowser

The FireMonkey TWebBrowser component allows the developer to specify a local file ( file://... ) or a URL ( https://www... ). However, there seems to be no way to get the browser to work by specifying an IP address ( 192.168.1... or http://192.168.1... etc.) The browser just appears to hang.

Is it possible to specify an IP address with this component?

I'm currently using Delphi 10.4.2 developing for iPhone. Safari on the same phone has no problem accessing 192.168.1... addresses.

Navigating to Websites using HTTPS protocol and IP address will be blocked in most browsers. Why? Website certificates that are used to confirm validity of specific website are domain based and not IP based.

This means that the Website will be treated as safe only when you navigate to it by using valid domain for which the website digital certificate was issued.

But when you try to navigate to such site using IP address of a server on which it is hosted most browsers will mark the site certificate as invalid and thus stop the navigation to such site. This is to prevent you from being redirected to another server that does not belong to specific domain for which web certificate has been issued.


PS: You can test this even with your default browser. Try navigating to a HTTPS site using URL using format https://xxxx:443 .

Note how I added 443 to the end of the specified URL. 443 is a default HTTPS port. Not specifying this port number as part of URL most browsers will always try to navigate using port 80 that is used for HTTP despite the fact that you specified HTTPS protocol in your URL.

Now if the website supports both HTTP and HTTPS protocols you may end up on HTTP site despite the fact that you specified HTTPS protocol in your URL.


And if that HTTP website offers automatic redirect to HTTPS site you may in the end actually end up on HTTPS version of that site. But it won't be HTTPS site containing the IP address you specified but instead the proper domain name of that site.

You can see this by trying to navigate using the above mentioned approach to https://142.250.180.174/ which is actually server for google.com .

NOTE: Not all Websites support this. For instance you can't reach HTTPS site of embarcadero.com using such approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM