Why we must use https or http inside href?
Note: I'm not asking about the difference between http and https. Demo program https://code.sololearn.com/WHdb1s0ACG3e/#html in ordinary browser we can type and open fb.com Screenshot image: https://postimg.org/image/uwkgmbbnv/ but inside href we can't use only fb.com we must use https inside href to open fb.com in demo program, if i don't use https or http: FB button redirect to this URL: https://code.sololearn.com/WHdb1s0ACG3e/fb.com not redirect to: fb.com (similar to when we type in the browser) <a target="_blank" href="fb.com" class="icon facebook"><span>Facebook</span></a> redirect to: https://code.sololearn.com/WHdb1s0ACG3e/fb.com Otherwise: <a target="_blank" href="https://fb.com" class="icon facebook"><span>Facebook</span></a> redirect to: https://fb.com Is it because if we don't decide the internet protocol, it will recognized as file/folder location path current site?
12/30/2017 11:15:20 AMAdi Pratama, S.Kom.
52 AnswersNew Answer
# Answer added # To answer your question check the SO link It's due to the various protols employed. think how will the browser differentiate between a file path or some other site link check below link for info. https://stackoverflow.com/questions/8997790/why-does-an-anchor-tags-href-values-need-http-preprended-to-the-url # Edited # @Adi When you edit your post. it should have a text which mentions edited at the top. Reading it and reading the answers seems our posts are off-topic. @Sean While the "S" in https may stand for secure. it's more like private not safe. If you landed on a phishing site. then it does not matter, if you enter data through http/https. it will be dangerous, And unsafe. You need to trust that the site will not be a bad vector. Read below for some info. https://textslashplain.com/2017/01/16/certified-malice/ https://www.troyhunt.com/on-the-perceived-value-ev-certs-cas-phishing-lets-encrypt/
To be technically specific on network requests (addendum to Krishna + SO): The browser must request the correct communication port (it always has to specify one, even though for most people it's done silently). protocol: server probably listening to port number... http: 80 https: 443 ftp: 21 etc...
So yes you need to put http, https, or www, just to let browser know that you redirecting user somewhere outside of this site(server), or it will try to find path you specified on current server. It is because each link is just a path to some document and protocol explicitly says that it is other server. By the way it can be any other protocol like ftp or voip.
@Adi: You need HTTP <b>OR</b> HTTPS - either is ok. For increased security, use HTTPS. As you suspected, if you don't specify the protocol (HTTP, HTTPS, FTP, etc.), then it will assume that you are referring to something stored locally (i.e on the website's server your HTML file is on), and will attempt to retrieve it from that server. Note: HTTPS does not mean you are going to a safe website, it just means that the communication between the website and you has been privatized. It is not, however, always able to keep people from seeing what you're doing. If you want privacy, most browsers have a private/anonymous/incognito mode. If you want to go a step better, get the real TOR browser and use it with a VPN. @Charan: Either HTTP or HTTPS is fine.
You use https or http so that SoloLearn will know you are trying to leave the website and go to another. Otherwise it will assume you are redirecting to a file path know as "fb.com"
If you want to redirect your page to a webpage, it becomes compulsory for you to use http or HTTPS because that's the way you differentiate between a website already hosted, and the file location or the new page of your own website. This also follows some hyper text protocols.
There are absolute and relative link for attribute of src/href. For absolute link, it must be started with http://, https:// or other protocol like ftp://. If the link not start with xxxx:// network protocol formats, it's relative link, so if you set your attribute as href="fb.com/kingdom.pratama" it is link to yoursite.com/fb.com/kingdom.pratama and not to http://fb.com directly.
In simple way it is communicator between your machine browser and server http or https is defined protocol of ftp for web or app pages, it tell how pages transfer from your device to server or vice versa.
Please consider HTTPS over http. You can secure a site with a ssl, but if you're site's code contains links via http, the ssl padlock will have a warning about insecure/mixed content. Google browsers give security warnings for sites without https, and Google index prioritizes https sites. HTTPS is quickly becoming the standard with the introduction of Let's Encrypt and other free SSL providers. Thus, if you want to code quality sites, be sure to save your clients the trouble of correcting all protocols in the code when they decide to implement https and just go ahead and use https over http. It's best to go ahead and get in the habit of using https or at least a scheme-less URL
@Shavat Turakulov Not sure if you're asking, but let's say you had a local Python webserver: // Termux on Android $ python -m http.server Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ... Then in the browser you would: http://localhost:8000/ or in a link: <a href="http://127.0.0.1:8000/">click here</a> (0.0.0.0 just means "all addresses for this host", like localhost) Note, requesting https without an actual secure service listening [beyond the scope of this post] will report an error; you can try it -- it's a protocol mismatch on that port (8000).
Http and https are just a protocol, like telnet, ftp, mail, etc. You have to be clear about your connection method. Maybe you dont know or you dont use, but there are a lot of protocol for connection.
https protocol is much safer than standard http protocol
It’s like a secure system for your site
use double // //site.com
http helps in telling browser that it's a file path otherwise it will become system path
https is a bit secured than http
Google Hyper Text Transfer Protocol Secure (HTTPS) is the secure version of HTTP, the protocol over which data is sent between your browser and the website that you are connected to. The 'S' at the end of HTTPS stands for 'Secure'. It means all communications between your browser and the website are encrypted. https://www.instantssl.com/images/http-vs-https.png
Looks obvious to me... You type it out so that you are sure your viewer goes to the intended webpage.