How can I change the title of 1 HTML window from another HTML window
Can I do this using Java开发者_Python百科script and if so how do I do that ?
If you have references for this it would be helpful.
Is there another way to do this without using Javascript ?
Thank you for all your help, advice & suggestions …
<html>
<head>
<title>Your title here</title>
</head>
<body>
content
</body>
</html>
Though your question is a bit vague, this is how the page title is set in html.
It depends. Have you opened the window whose title needs to be changed? If you have, it's quite easy:
var theWindow = window.open('whateverUrl');
theWindow.addEventListener('load', function(evt) {
theWindow.document.getElementsByTagName("title")[0].innerHTML = "Your New Title";
}, false);
This assumes many things: that the page opened will have a <title>
element, that the browser supports innerHTML, and that the browser supports addEventListener, but this is just an example and can easily be fixed in those regards.
If you do not have a reference to the window, you will have to obtain one.
精彩评论