Open develoopeer opened 1 week ago
Hey, thanks for contributing!
I'm not sure there's any benefit to strictly following the URI RFC, as in my browser's address bar I can simply type google.com
which would be treated as a valid address. Plus, I don't think anyone would actually want to fully type https://
every time.
Something like the following regex should probably suffice in returning true
for isValidUrl
as a backup when the URL instantiation fails:
^(?:[a-z0-9-]+\.)+[a-z]+$
The benefit of following the URI RFC is the fact, that you can pass URI to javascript window.open
function directly.
If string like google.com
will be passed to it, address of current page will be prepend to URL, and you will get localhost/google.com
. You need to prepend a scheme to string by yourself.
But i feel like you noticed correctly. No one would type https://
manually, or even if you have URL string in OS buffer, you will pass it to your browser, not to the search widget.
Feature from #229 issue implemented with the following behavior:
If string passed from input is a valid URL, tab with this string will be opened, not the search engine with URL as a search request.
URL from search input field will be considered valid, if they are corresponding to RFC 3886, Generic Syntax of URI`s. That does mean that string: