NPAPI:DocumentTitle

From MozillaWiki
Jump to: navigation, search

Status

Withdrawn.

Contributors

  • Last modified: September 27, 2011
  • Author: Alex Plotnick

Problem Summary

Plugins sometimes need to set the document title. For instance, a plugin might want to display a title extracted from the metadata of whatever object it is currently showing.

One can use NPRuntime to accomplish this by manually setting the contents of the document.title element, but this seems like a heavy-weight solution to a simple problem.

Current Proposal

A new variable, NPPVdocumentTitle (value = 23), will be added. To supply a document title, a plugin may call NPP_SetValue with this variable and a NUL-terminated, UTF-8 encoded string that the browser should display as the title for the current document:

  char* title = GetTitle(); /* UTF-8 encoded, NUL-terminated */
  NPN_SetValue(instance, NPPVdocumentTitle, title);

The browser should make the same kind of best-effort attempt to display this title as it does for, e.g., the HTML TITLE element.

Open Issues

  • None