开发者

accessing a chrome extension from outside the browser

Is it possible to access a Chrome Extension from outside the browser?

I would like to be able to run a command from my text editor (MacVim) that refreshes the page on which I am working. From reading the Chrome Extension documentation it开发者_开发技巧 looks like I could try something really hack-y, like opening a page that uses Chrome message passing to refresh another page, but there does not seem to be a strait-forward way to do this.

I am running Mac OS X. I've tried the shell command:

$ open <url>

But that opens a new tab every time in Chrome, so this doesn't help when I'm using the developer tools


You are right, there is no straight forward solution.

Your hacky approach is the simplest way to go. Only instead of messaging I would put a tab creation listener into background page, and when a tab with some special URL is created (http://example.com/?do=refresh) - close it and refresh the next selected tab. You will see new tab flickering, but that's as good as it gets.

You can also look into using WebSocket API, for which you would need to write a server side app (which you need to call from your editor somehow). Not sure how this all might turn out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜