Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
El código está redirigiendo al visitante a la página de inicio sin importar en qué enlace se haga clic

Tengo un sitio web y me gustaría redirigir a los visitantes de diferentes países a una ruta URL. Para este propósito, utilizo el siguiente código. El problema con este código es que siempre lo redirige a la misma URL, sin importar en qué enlace haga clic en la página. ¿Qué me estoy perdiendo?

 <!-- IP REDIRECTING --> <script> // Geolocation Redirect let eng_list = ['BE', 'DK', 'FI', 'FR', 'IS', 'IT', 'HR', 'NL', 'RO', 'SK', 'HU', 'BG', 'GR', 'IE', 'GB', 'CA', 'LU', 'NO', 'PL', 'SE', 'RS', 'CZ', 'TR', 'US', 'AL', 'EE', 'LV', 'LT', 'MK', 'PT', 'SM', 'ES', 'IC', 'EA']; let presentUrl = location.href; let targetUrl = "https://www.homepage.de/en"; // Getting the country code from the user's IP if (presentUrl != targetUrl) { $.getJSON('https://ipinfo.io/json', function(data) { if (eng_list.includes(data.country)) { location.href = "https://www.homepage.de/en"; } }, "jsonp");}; </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Su línea en el if siempre redirige al "subdominio" en inglés, ya que lo tiene codificado como tal a través de esta línea:

 location.href = "https://www.homepage.de/en";

Aunque esto no es realmente un "subdominio", pero no viene al caso. Si desea que se apliquen diferentes idiomas, debe eliminar la codificación fija a /en y hacer que esa parte "varíe" según las condiciones necesarias.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!