mrhands
mrhands

Reputation: 1533

How to access chrome.runtime in options page in Chrome Extension?

I want to create option page in chrome extension development and this is the manifest :

"manifest_version": 1,
"author":"Handita Okviyanto",
"name": "My Extension",
"options_page": "home.html",

And then I want to access chrome.runtime in my home.html the file look like this :

<html>
....
<script src="app.js">
....
</html>

And the app.js look like this :

$(document).ready(function(){
   var url = chrome.runtime.getUrl('login.html');
});

But when I debug through the chrome developer the result is undefined. I can access this through the background.js or contentscript.js

image chrome

I'm still confuse in what page should I use chrome object.

updated

The additional image chrome undefined

Upvotes: 1

Views: 616

Answers (1)

mrhands
mrhands

Reputation: 1533

Finally I found the problem, I included the library with global variable name chrome so it's overrided by the variable.

so I just search all the variable named chrome through all files. And found chrome in one of the file js I have included.

Upvotes: 1

Related Questions