Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search bar acts like address bar feature implemented #256

Open
wants to merge 2 commits into
base: release/v0.7.0
Choose a base branch
from

Conversation

develoopeer
Copy link

@develoopeer develoopeer commented Nov 14, 2024

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:

@svilenmarkov
Copy link
Member

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]+$

@develoopeer
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants