A
A
Andrey Rogov2012-10-06 11:57:12
JavaScript
Andrey Rogov, 2012-10-06 11:57:12

How bad is it to redirect IE users to avoid spams in the address bar?

Background The customer registered a domain type "project_name.rf" (in Russian) for a new trading project approximately every month. At the same time, I paid a lot of money to the web-studio for connecting and setting up a new project. There are about two pages of unique information on each project.
And so I was asked to “make them an admin panel” for adding new projects on their own, albeit without using second-level domains. In turn, I suggested this type of addressing: company_name.ru/project_name, where project_name is in Russian. It completely flew out of my head that in InternetExplorer browsers, all non-cp1252 address characters become human-unreadable.
While admiring the completed work in different browsers, I was disappointed by the unaesthetic nature of the previously chosen approach. And the only solution that came to mind is the script below.
According to statistics, the site has less than 200 visitors per month, 10-30% of them on IE.
Essence:
This function is located at the beginning of the html page and replaces the page address in Internet Explorer browsers with its readable utf-8 representation.
This reloads the page, but leaves a readable address in the address bar. (only tested in IE9 + ieTester)

(function() {
  // Заменяет в ie кракозябры на русские буквы.
  if(navigator.appName !== 'Microsoft Internet Explorer'){
    console.log("Это не IE");
    return;
  }
  var newHref = decodeURIComponent(window.location.href); // Заменяем кракозябры на русские.
  if(newHref == window.location.href) {
    console.log("В location изменять нечего");
    return;
  }
  if(window.location.href.indexOf("#-") !== -1) {
    console.log("Это повторный заход");
    return;
  }
  window.location.replace(newHref+"#-"); // Переадресация.
})();

Do you know what kind of problems can arise with indexing, caching and apache + php executing two identical requests almost simultaneously?
PS Yes, I know that it's terrible. But the server generally does not care about a hundred extra requests per month. For IE users (if there are no problems) - this is an extra ping + a little more time and an extra page (only the body) for traffic.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Peretyatko, 2012-10-06
@viperet

It is more correct to do your redirection on the server side so that two requests do not come to the backend, the first of which is useless. So offhand - on nging this can be done using the set_misc module and its set_unescape_uri command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question