📜 ⬆️ ⬇️

For making quick bookmarks, shortening links, etc.

Once I noticed one interesting thing. Everything seems to be logical - but the effect can be used.

1. Open any page in the browser, for example http://example.com/ .
2. Then, before the address, type in some address, for example, the domain habrahabr.ru and put a question mark after it, '?', So that you get the string
habrahabr.ru?http://example.com/ .
3. Now, if you download the resulting address, the browser will display the following page: http://habrahabr.ru?http://example.com/ .

Ie, if routing is not configured, then we can say that a variable named http://example.com was passed to habrahabr.ru/ via GET.

There in the script you can get the name of this variable and do whatever you like with it:
- save to bookmarks
- shorten and give the user a short version of the link (similar to services like b23.ru )
- anything else.
')
For the sake of interest, I made myself such a quick bookmark service. The script after parsing and saving the link made a redirect to the received address and for me there were no changes on the screen.
Naturally, for the industrial use of this idea, you need a short domain with a very simple taiping.

This feature does not work in all browsers. For example, FF with such a request, instead of passing the address to the script, launches the address search using the default search engine. But if you put a slash before the question mark - the job.

Source: https://habr.com/ru/post/53470/


All Articles