var mywin = null;
var mywin1 = null;
var mywin2 = null;
var mywin3 = null;
chrome.browserAction.onClicked.addListener(function () {
if (mywin == null || mywin.closed) {
mywin = window.open('https://google.com');
} else {
mywin.focus();
}
if (mywin1 == null || mywin1.closed) {
mywin1 = window.open("https://facebook.com");
} else {
mywin1.focus();
}
if (mywin2 == null || mywin2.closed) {
mywin2 = window.open("https://youtube.com");
} else {
mywin2.focus();
}
if (mywin3 == null || mywin3.closed) {
mywin3 = window.open("https://gmail.com");
} else {
mywin3.focus();
}
});
此代码在选项卡已打开时避免重复的新选项卡,但此代码在单击时正常工作但经过一段时间后我尝试单击它将再次打开所有选项卡请帮助我
答案 0 :(得分:2)
将第二个参数$json='{
"query": { "match_phrase": { "date_added": "2017-02-08" } },
"size": 0,
"aggs": {
"date_added": {
"terms": {
"field": "bounce_type.keyword"
}
}
}
}
';
$params = [
'index' => $index_name,
'type' => $index_name,
'body' => $json
];
传递给name
有关window.open的更多信息,请点击此处... http://www.w3schools.com/jsref/met_win_open.asp