Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

537
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda