admin管理员组

文章数量:1406943

I'm trying to work with some javascript that accesses chrome.runtime in Google Chrome. The script calls the chrome.runtime.getManifest() function, but my console says that function is not defined. I've read through Google's documentation on this subject, and it should be there. I've done some research, and for everyone else, using this function seems to be a non-issue, so I feel like I'm missing something. However, when I run console.log(chrome.runtime); I see this:

It appears that only two functions are defined in this object, connect and sendMessage.

What am I missing?

I'm trying to work with some javascript that accesses chrome.runtime in Google Chrome. The script calls the chrome.runtime.getManifest() function, but my console says that function is not defined. I've read through Google's documentation on this subject, and it should be there. I've done some research, and for everyone else, using this function seems to be a non-issue, so I feel like I'm missing something. However, when I run console.log(chrome.runtime); I see this:

It appears that only two functions are defined in this object, connect and sendMessage.

What am I missing?

Share Improve this question edited May 14, 2015 at 11:22 Halvor Holsten Strand 20.6k17 gold badges88 silver badges102 bronze badges asked May 14, 2015 at 6:04 jlivingstonjlivingston 511 silver badge4 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 3

I found the answer. These functions are only available when the javascript is running from a Chrome App.

For Chrome extensions, this method is only available in the background scope.

本文标签: javascriptchromeruntimegetManifest() is not definedStack Overflow