Window.name

Summary

Gets/sets the name of the window.

Syntax

JavaScript
<var>string</var> = window.name;
window.name = <var>string</var>;

Example

JavaScript
window.name = "lab_view";

Notes

The name of the window is used primarily for setting targets for hyperlinks and forms. Windows do not need to have names.

It has also been used in some frameworks for providing cross-domain messaging (e.g., SessionVars and Dojo's dojox.io.windowName) as a more secure alternative to JSONP. Modern web applications hosting sensitive data should however not rely on window.name for cross-domain messaging but instead rather utilize the postMessage API.

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/window/name

API HTML DOM NeedsCompatTable NeedsExample NeedsMarkupWork NeedsSpecTable Property Reference Référence Window