This worked - thank you for your help! -dave
On Apr 7, 7:40 pm, Jonathan <jdd...@gmail.com> wrote: > If you can't figure out a better way you can always do a setTimeout in > the document.ready to call a function after a set delay to poll the > document.title again. > > check_title = function() { > alert(document.title); > > } > > setTimeout(check_title, 1000); > > On Apr 7, 4:09 pm, DaveT <dave.tru...@gmail.com> wrote: > > > I don't exactly know where, in relation to the other Javascript. If > > you look at the site I mentioned to Michael, my code is in an include > > file that forms an outer part of the frameset, ie a visual page > > header. > > > My code is in a jQuery document.ready function, so the DOM is loaded, > > but I think you're right, that the other javascript hasn't finished > > running, so the document.title hasn't been set yet. > > > I guess I need to figure out a way to have this code run after all the > > other code has run. And I have no idea how to do that. > > > (I'm pretty new to Javascript, don't even have a debugger or anything, > > just Firebug.) > > > Thanks for your thoughts! > > > -dave > > > On Apr 7, 6:27 pm, Jonathan <jdd...@gmail.com> wrote: > > > > Like you suspect the title is probably getting set by javascript after > > > it's loaded and you're just accessing it too soon. Where in your code > > > are you doing 'var txt = docment.title' > > > > On Apr 7, 2:57 pm, "Michael Geary" <m...@mg.to> wrote: > > > > > document.title *is* the way to do that. You have a case where it doesn't > > > > work? Now I'm curious - I'd sure like to see a test page if you have > > > > one. > > > > > -Mike > > > > > > From: DaveT > > > > > > I'm working with a fairly complex page that is heavily > > > > > controlled by some Javascript that's external to my code. I'm > > > > > trying to read the document's title text, first trying to use > > > > > straight Javascript, ie: > > > > > > var txt = document.title; > > > > > > And while this works on a simple page (where the title is set > > > > > by the document's head > title tag), it doesn't work on the > > > > > more complex Javascript-controlled page. I suspect the > > > > > Javascript is setting the browser's title bar property rather > > > > > than using the title tag. > > > > > > So I thought I'd try using jQuery to get this, using code like this: > > > > > > var jQtxt = $('head > title:first').text(); > > > > > > It's trying to do the same thing as the first example, but > > > > > oddly doesn't seem to work on IE even with a simple page. > > > > > > So my question boils down to: > > > > > > What's the simplest rock-solid way to get the browser's > > > > > titlebar text that works in both IE and Firefox? > > > > > > Appreciate any help! > > > > > > -dave