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'';
}
}