I have an application which opens another angular application in a new tab on clicking a button. I need to override the title of the new tab from the parent tab and set a value. Some mock code below
<!DOCTYPE html>
<html>
<head>
<title>New tab</title>
</head>
<body>
<div>
<input id="toolId" placeholder="ToolId" style="padding: 4px 0; width: 70px;" />
<button id="button">Launch</button>
</div>
<script>
window.onload = function () {
document.getElementById('button').addEventListener('click', () => {
var newWin = window.open('http://localhost:4200', "_blank");
// add a load listener to the window so that the title gets changed on page load
newWin.onload = function() {
newWin.document.title = 'New Title';
console.log('Loaded');
};
// newWin.document.title = 'New Title';
})
}
</script>
</body>
</html>
But when i try to do this , i always see the default value set by the angular application rather than what is set by the above code. What am i missing here ? Is it blocked by chrome by chance, could not find any relavent doc if it is .