我的问题是关于多功能框的。 Chrome API 提供的想法,我想知道是否有可能在 list 上有多个关键字。
我在考虑正则表达式或类似的东西,但我真的不知道该怎么做......
最佳答案
我想我刚刚找到了解决方案。
我发现当您使用 google 搜索“TRY”时,网址是:
当它来自 Chrome URL 时,它是:
所以基本上,如果我检查 url 上是否有 sourceid=Chrome,我可以像这样重定向。你怎么看?
// If Google Search from the URL (sourceid)
if(URL.match('google') && parseUri(URL).queryKey['sourceid'] == 'chrome')
{
chrome.tabs.update(tabId, { url: 'http://search.yahoo.com/search?p=' + parseUri(URL).queryKey['q'] });
return;
} // If Bing Search from the URL (setmkt)
else if(URL.match('bing') && parseUri(URL).queryKey['setmkt'])
{
chrome.tabs.update(tabId, { url: 'http://search.yahoo.com/search?p=' + parseUri(URL).queryKey['p'] });
return;
}
关于javascript - 多功能框 multipe 关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5354426/