从扩展选项页面链接到chrome:// chrome / extensions [英] Link to chrome://chrome/extensions from extension options page

查看:4250
本文介绍了从扩展选项页面链接到chrome:// chrome / extensions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Chrome引导程式样式(请参阅 http://roykolak.github.com/chrome-bootstrap/)来构建我的选项页面。现在我想在左边栏菜单中有一个链接回到chrome:// chrome / extensions,但点击它会在控制台中返回一个错误:不允许加载本地资源:chrome :// chrome / extensions

I'm using the chrome bootstrap styles (see http://roykolak.github.com/chrome-bootstrap/) to build my options page. Now I'd like to have a link back to chrome://chrome/extensions in the left-sidebar menu, but clicking on it returns an error in the console: Not allowed to load local resource: chrome://chrome/extensions

推荐答案

你可以用 chrome .tabs.update 您不需要选项卡权限

You can open this with chrome.tabs.update, you don't need the tabs permission for this.

options.html

<script src="options.js"></script>
<a href="#" id="test">test</a>

options.js

document.addEventListener('DOMContentLoaded', function() {
    document.getElementById('test').addEventListener('click', function() {
        chrome.tabs.update({ url: 'chrome://chrome/extensions' });
    });
});

这篇关于从扩展选项页面链接到chrome:// chrome / extensions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆