Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome extension options not calling javascript file

I have an options page in my Chrome extension which calls a javascript file. I tried using javascript to save my options but it wasn't working, so I tested it with some very simple code:

options.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <script type="text/javascript" src="jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="options.js"></script>
</body>
</html>

options.js

$(document).ready(function() {
  alert('loaded');
  console.log('loaded');
});

Neither the alert nor the console.log seems to be firing when I click options in the Chrome extensions page. This makes me think that the options.html file isn't loading the js file, but it could be that I'm wrong to expect alert and console.log to work like this with extension options.

Any ideas what's going wrong here?

like image 992
GluePear Avatar asked Feb 10 '23 17:02

GluePear


1 Answers

To see the results of any console.log you need to right-click on the options modal window and select "Inspect Element". Any console messages will appear here.

However alert commands appear to be suppressed, or at least I was unable to see any.

like image 185
GluePear Avatar answered Feb 12 '23 09:02

GluePear