Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

534
Vistas
Javascript - Forward Slash appended automatically in URL with the Window.Location.Hash

In my Angular JS website, I wish to append the text "#Page/" to the URL using Javascript. Here my problem is that the forward slash(/) is getting added when using the code Location.hash

For example, Let say the URL is https://MyWebsite.com/Products

        var location = window.location;
        location.hash = "#page/" + pageNumber;
        window.location = location
       
    

After executing the above code, the Window.location turned out to be https://MyWebsite.com/Products/#page/1.

But what I need is the forward slash(/) should not be included between products and #page. https://MyWebsite.com/Products#page/1.

The strange thing is that when I checked the same code with the other websites don't have Angular JS, implemented only with the Asp.net Webforms and ASP.net MVC, I got the desired result.

Does this kind of issue have something to do with the Angular JS?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I believe # is special character reserved for a page fragment reference. See https://www.ietf.org/rfc/rfc3986.txt

Can you do with without # or use the # to reference the fragment? e.g.

window.location.href += 'page/' + pageNumber + '#' + pageFragment;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda