Good afternoon, dear colleagues. I want to share with you my time - perfect page 404 . This is nothing more than the written code of the article by Jan Lloyd "Perfect Page 404" ( original , in Russian ). Compared to the original code, the page has the following advantages:
Adapted to search queries of popular Russian search engines, including now the script can read requests from a search engine entered in Russian letters.
When sending a message about a broken link, the user is not transferred to a new page, but receives thanks on the same (thanks, Ajax).
For those who are not familiar with Lloyd’s article, I’ll tell you everything from the beginning:
The 404th error page does not say that everything is bad. It helps to find the page you need, apologizing along the way.
If you came to the site from one of the popular search engines (yandex, rambler, mail.ru, google, bing.com, nigma), the page will define your search query and help the user to find that very page. For example, your website is selling ZP-300 and ZP-800 simulators. If the user was looking for ZP-300 - you can immediately issue a link to the page with this simulator. And so for every popular name.
If a user comes from a site whose administrator you are, then he will have the opportunity to inform you about a “bad” link with one click of a button.
If the user comes from a regular site, then he will be able to inform you about a “bad” link with one click of a button, so that you yourself can solve this problem with admins of a crookedly referring site.
Use on health. All the places you need to pay attention to are marked with a comment starting with “//!”. I am always open to criticism. I would be grateful if you point out errors in the code, if I suddenly didn’t catch any. Update:working example Update2: Fixed code. Replaced net referrer to avoid XSS Update3: In the examples, if you are looking at switching from a search engine through IE, your script can write to you that the user was looking for krakozyabry. This is not a script bug. In reality, everything is shown as necessary. Prsto on the page with links IE automatically tries to replace the symbols with percentages into native ones. To see the result from the search engine in IE, you must manually enter the address http://baseowl.ru/search.php?q=%D0%BB%D0%B8%D0%B2%D0%B0%D0%BC Update4: The latest fixes were made at 00:30 Moscow time. Those who downloaded the archive before this time - download it again - you will receive a corrected version.