7

While surfing to a site within my company, the browser's title seems to be an error message.

In the taskbar, I can see the following:

TF400813: The user 'e387ba6a-0...

While using tasklist /V | findstr "TF", I can see the following:

TF400813: The user 'e387ba6a-09a6-4c12-8c76-6492ea8f582d\dominique.xxxxx

(I've blurred the letters of my family name for privacy reasons, but I can tell you that only five letters are shown, there seems to be a maximum of 72 characters.)

You can clearly see that not the entire error message is visible.

Does anybody know how (if possible) I can see the full window title?

My operating system is Windows-10.

Edit after some more investigation
The following PowerShell command doesn't work:

Get-Process | format-table id,name,mainwindowtitle -AutoSize

Most probably because the mentioned browser window is just one of several browser windows, and the Powershell command only shows the title of the mainwindow.

Thanks in advance

Dominique
  • 1,993
  • 9
  • 30
  • 65
  • What did you mean by `"the mentioned browser window is just one of several browser windows"` ? can you elaborate a little and tell us which browser did you mean by ? – Hackoo Nov 08 '21 at 09:22
  • I'm working with Google Chrome, and apparently you can have different browser windows under the same process ID. When trying to find the title using the Powershell command, I just get one single result for that process ID, and it's not the one with that particular large title. When I close the window, shown in Powershell, I just get a default title, not the one I'm looking for. – Dominique Nov 08 '21 at 09:29
  • 2
    Is there a reason you don't use the browsers Inspect/Debug feature to look at the HTML of the page and find the title? – JPhi1618 Nov 08 '21 at 17:48
  • you can always use *khalifa* *attwood* as dummy names. – NotStanding with GoGotaHome Nov 09 '21 at 04:52

3 Answers3

20

Frame challenge: Press F12 in the browser to open the dev tools. The full contents of the title tag will be visible in the head section of the inspection pane.

Jackdaw
  • 1,087
  • 2
  • 6
  • 19
dlatikay
  • 1,021
  • 1
  • 6
  • 8
  • 1
    …or even just `Ctrl`+`U`. The `` element is rarely filled dynamically, and usually is amongst the first lines of the html. – Bergi Nov 09 '21 at 00:51
  • 13
    If you're using the browser Dev Tools, then it would be better to type `console.log(document.title);`, as that would display the title, even if it was dynamically set. Looking for a `` in the `` doesn't cover any time that it's set dynamically. – Makyen Nov 09 '21 at 01:19
  • 4
    In Chrome, `ctrl-u` shows the source. If you need access to the console, it is `ctrl+shift+i`. From there, you don't even need `console.log`. Just typing in `document.title` will resolve the DOM and show you its content. – Nelson Nov 09 '21 at 02:18
  • @Makyen setting the `document.title` will go as far as creating the `` element, and as little as setting its text content. https://html.spec.whatwg.org/multipage/dom.html#document.title – Kaiido Nov 09 '21 at 15:43
  • 1
    @Kaiido Yes, but if the HTML has more than one `` element, then you're not guaranteed to find the one which the browser is actually using. Sure, there's not *supposed* to be more than one `<title>` element, but that isn't something which is guaranteed. I'd prefer to do a little more typing than spend time looking for something in the HTML, which *might* not be the thing I'm actually looking for. – Makyen Nov 09 '21 at 16:19
  • @Makyen it is guaranteed to be the first. – Kaiido Nov 09 '21 at 22:08
  • @Kaiido Unless it has been dynamically been changed by a script somewhere else. – Nelson Nov 11 '21 at 02:22
  • @Nelson no. That's my point, it's **always** the text content of the first element in the DOM, or the empty string in case there is no such <title> element. The getter steps of `document.title` is precisely to return the text content of the first title element in the DOM or `""`. So, no, dynamically setting the document's title won't change this fact. That someone prefers to type `document.title` in the console rather than checking the DOM's rendered markup is a personal preference, mine is to hover the tab I want to check the title of, but that's just a preference. – Kaiido Nov 11 '21 at 02:37
  • @Kaiido What you're saying is wrong, and easily tested. The `document.title` returns the browser's current title, whether it is set by the first title tag or by `document.title = "string"`. You can go on to any page, change the title via `document.title = ` and then immediately retrieve it. I'm not sure why you think otherwise. – Nelson Nov 11 '21 at 02:45
  • @Nelson you probably have issues understanding what I said... Please read again all my comments here. When you do `document.title = "foo"` what happens is that the browser will search for the first in the DOM, if there isn't one, it will create one and append it in the , and then it will set the text content of this first <title> to the string `foo`. So "Looking for a <title> in the " DOES "cover any time that it's set dynamically.". Note that we are talking about the DOM view from Dev-tools, and obviously not about the markup from `source:`. – Kaiido Nov 11 '21 at 02:52
  • Ok, so you're referring to the GUI version of `document.title`, as presented by the Elements tab in the DOM viewer. We're basically talking about the same thing. – Nelson Nov 11 '21 at 02:58
  • "the GUI version of document.title"? What's that? No I am saying that what @makyen said was wrong, that you can very well only look at the text content of the first in the DOM as proposed by this answer and you'll get the current document's title. I'm saying that if you do `document.title = "foo"; document.querySelector("title").textContent = "bar";` then `document.title` will return `"bar"`. – Kaiido Nov 11 '21 at 03:00
7

You can try this:

tasklist /fi "WindowTitle eq TF*" /v /fo list

tasklist /fi "WindowTitle eq TF*" /v /fo csv

tasklist /fi "WindowTitle eq TF*" /v /fo list | find /i "TF"
Ricardo Bohner
  • 3,903
  • 2
  • 18
  • 12
4

I don't know if this powershell script can answer or not your question for your case :

$ArrayBrowsers=@("firefox","chrome","iexplore","msedge","opera")
ForEach ($Browser in $ArrayBrowsers) {
    Get-Process $Browser -EA SilentlyContinue |
        Where mainwindowtitle -NE '' |
            select ID,name,mainwindowtitle | FT -AutoSize
}
Hackoo
  • 1
  • 9
  • 22
  • Sorry for pulling back the "Accept", but the other answer, based on `Tasklist`, is more suited for my needs. – Dominique Nov 08 '21 at 10:43