如何在Google Chrome浏览器扩展程序弹出窗口中包含链接?

如何在Google Chrome浏览器扩展程序弹出窗口中包含链接?

问题描述:

我遇到了一些我使用过的Google Chrome扩展程序存在的问题。我已将这段简单的代码放在弹出页面的顶部:

I am experiencing some problems with a google chrome extension I have made. I've put this simple line of code at the top of the popup page:

<a href="http://www.google.com">google</a>

然而,点击它不会产生任何结果。但我有其他人的扩展,其中包括弹出窗口中的链接,完全相同,似乎工作。在这里有一些权限错误吗?

However, clicking on it yields no results. But I have someone else's extension that includes links in the popup in exactly the same way, and seems to work. Is there a permissions error of some kind here?

链接在扩展弹出窗口中的行为与普通标签页中的行为有所不同。在弹出窗口中,将 target =_ blank(或任意命名的目标)添加到您的定位标记或使用标签API的 chrome.tabs.create 方法(在清单文件中需要 tabs 权限)。

Links behave a bit differently in extension popups than they do in ordinary tabs. In a popup, add target="_blank" (or an arbitrarily named target) to your anchor tags or use the tab API’s chrome.tabs.create method (which will require tabs permission in your manifest file).