dart:html
库中Window.close
方法的用法介绍如下。
用法:
void close()
override
关闭窗口。
仅当WindowBase 对象为script-closeable 并且允许调用close 的窗口浏览该窗口时,此方法才会成功。
一个窗口是script-closeable,如果它是由另一个窗口打开的窗口,或者它是一个在其历史记录中只有一个文档的窗口。
由于浏览器安全函数,一个窗口可能不允许导航并因此关闭另一个窗口。
var other = window.open('http://www.example.com', 'foo');
// Closes other window, as it is script-closeable.
other.close();
print(other.closed); // 'true'
var newLocation = window.location
..href = 'http://www.mysite.com';
window.location = newLocation;
// Does not close this window, as the history has changed.
window.close();
print(window.closed); // 'false'
也可以看看:
- Window close discussion 来自 W3C
相关用法
- Dart Window.closed用法及代码示例
- Dart Window.location用法及代码示例
- Dart Window.top用法及代码示例
- Dart Window.opener用法及代码示例
- Dart Window.parent用法及代码示例
- Dart WindowBase.parent用法及代码示例
- Dart WindowBase.top用法及代码示例
- Dart Window用法及代码示例
- Dart WindowBase.close用法及代码示例
- Dart WindowBase.location用法及代码示例
- Dart WindowBase.closed用法及代码示例
- Dart WindowBase.opener用法及代码示例
- Dart WebSocket用法及代码示例
- Dart WebSocketTransformer用法及代码示例
- Dart MapMixin.containsKey用法及代码示例
- Dart Iterator用法及代码示例
- Dart AttributeClassSet.intersection用法及代码示例
- Dart num.sign用法及代码示例
- Dart TransformList.last用法及代码示例
- Dart FileList.first用法及代码示例
- Dart CanvasRenderingContext2D.drawImageScaledFromSource用法及代码示例
- Dart FileList.length用法及代码示例
- Dart Iterable.takeWhile用法及代码示例
- Dart LinkedHashMap用法及代码示例
- Dart RegExp.pattern用法及代码示例
注:本文由纯净天空筛选整理自dart.dev大神的英文原创作品 close method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。