Closed Bug 259067 Opened 20 years ago Closed 20 years ago

Cannot set window title from script

Categories

(Core :: XUL, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: surkov, Unassigned)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616

If title was setted as attribute then i can't set title from script by
window.title property

Reproducible: Always
Steps to Reproduce:
1. set attribute title of window
2. change property window.title after window load

Actual Results:  
window title will not be changed

Expected Results:  
window title should be changed
The issue here is that the onload handler executes _before_ the window title is
set from the "title" attribute (thus giving you a chance to change said
attribute in your onload handler).  If you have to write to window.title
instead, just put it on a timeout...
Assignee: general → nobody
Component: DOM: Level 0 → XP Toolkit/Widgets: XUL
QA Contact: ian
Do you mean that it's more feature than bug? It's not clear feature because when
load event is called then I mean initialization has finished. But window title
was not be setted.
Yes, we use that code pattern ourselves, but also this one:
document.documentElement.setAttribute("title", newTitle);
(obviously this only applies in the onload handler)
And another way that works is not to set the title attribute, e.g.
<window onload="title='foo';"/>
Whiteboard: DUPEME
Depends on: 126903
What Boris describes in comment 2, I'd call a bug. It's an unfortunate side
effect of the fact that we ourselves set the window title in the load handler.
We should consider not setting the window's title from the title attribute if
the window's title has already been set before our load handler runs.
As from 1.8a4 setting document.title should now work.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.widgets
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: