WebExeBuilder Documentation

getPageTitle

Category: Browser Control

Namespace: web.browser.getPageTitle

Description

Get the title of the currently loaded page. Returns the page title from the <title> tag.

Syntax

await web.browser.getPageTitle();

Parameters

None

Returns

Promise<string> - Returns the requested string value

Example

Simple example

const title = await web.browser.getPageTitle();
console.log('Page title:', title);

Practical example

const title = await web.browser.getPageTitle();
document.getElementById('page-title').textContent = title;

Advanced example

async function updateWindowTitle() {
    const pageTitle = await web.browser.getPageTitle();
    const url = await web.browser.getCurrentUrl();
    
    // Set window title to page title
    await web.window.setTitle({ title: pageTitle });
    
    console.log('Page:', pageTitle, 'at', url);
}

Use Cases

  • Display page title in UI
  • Update window title
  • Show page name in tabs
  • Implement bookmarks with titles
  • Track visited page names
  • Display in navigation history
  • Show in recent pages list
  • Update application title bar
  • web.browser.getCurrentUrl()
  • web.window.setTitle()

Notes

  • Part of browser control functionality
  • Asynchronous operation
  • Returns promise