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

252
Visualizações
How to detect if a page is loaded into a named window?

Ok, I posted this question a month ago. Now I think I can rephrase it a bit, and maybe someone can understand my issue somewhat better now.

We´re using named windows to reuse tabs when the user is opening several links of the same type. Links to different products all open in a window named Products <a href='somepage' target='Product'>Product B</a>. Other collections leading to windows named Org.Info, News and so on.

The window name is displayed in the top bar for any "Named" window using this code in our shared layout-page.

<span id="windowname"></span>
    
<script>
        if (window.name.length > 0) {
            $('#windowname').text('Window: ' + window.name);
        }
</script>

All is working well, the window name is showing if it isn't empty, and the tab is reused as expected.

But if the user continue to browse in this named window I want the window.name to be cleared again, when the next page is loaded.

I tried with this script to clear it on window.unload, and it clear the window.name, but then the window reusing isn´t working anymore.

window.onunload = function () {
    window.name = '';
}

Is there a way to clear the name, only if the call doesn´t have a target window specified?

Something like this?

window.onunload = function () {
if(the call to open a new page in this window has a target.value !=window.name){
    window.name = target.value'';
}
}
about 4 years ago · Santiago Trujillo
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