提交 4028b9be 编写于 作者: A Alex Dima

Especially account for VS Code in dom.windowOpenNoOpener

上级 77245046
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as platform from 'vs/base/common/platform';
import { TPromise } from 'vs/base/common/winjs.base';
import { TimeoutTimer } from 'vs/base/common/async';
import { onUnexpectedError } from 'vs/base/common/errors';
......@@ -1063,5 +1064,14 @@ export function computeScreenAwareSize(cssPx: number): number {
* See https://mathiasbynens.github.io/rel-noopener/
*/
export function windowOpenNoOpener(url: string): void {
window.open(url, '_blank', 'noopener');
if (platform.isNative) {
// In VSCode, window.open() always returns null...
window.open(url);
} else {
let newTab = window.open();
if (newTab) {
newTab.opener = null;
newTab.location.href = url;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册