ijgnd / anki21__editor_add_hyperlink

5 stars 7 forks source link

handle address without http(s) prefix like www.example.com #17

Closed RandmTask closed 1 year ago

RandmTask commented 1 year ago

Is there a reason I have to type http:// before the web address?

If I type www.cnn.com the hyperlink is this.

http://127.0.0.1:62610/www.cnn.com

If I type https://www.cnn.com it works as expected

Not sure if its a bug or not?

Using Anki 2.1.61

Thanks

ijgnd commented 1 year ago

That depends on your definition of bug.

from a technical point of view that looks good: www.cnn.com is not a full url, see https://en.wikipedia.org/wiki/URL Anki resolves this relative to the "base" which is the anki reviewer.

from the point of view of a regular user (who expects a similar behavior to what you get when you type www.cnn.com in the browser address bar) that's not expected behavior so it's a bug or pretty close to it. I don't want to change the behavior for everyone because a vocal minority of users might rely on the old behavior. So I should add an option to the add-on config like the following "Prefix incomplete urls with": "http" (or a user could use "https" or leave it empty to keep the old behavior), I guess.

Do you have other ideas?

RandmTask commented 1 year ago

Yes that would be perfect. Thank you!

RandmTask commented 1 year ago

Works perfectly, thank you :)