简体   繁体   中英

JS not working in popup window

chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('testcb.html', {
'bounds': {
  'width': 1240,
  'height': 720
    }
  });
}); 

That opens

<script type="text/javascript" src="libs/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="cb.js"></script>

<link rel="stylesheet" type="text/css" href="css/design.css"/>
<link rel="icon" type="image/png" href="favicon.png"/>

The java script does not work whatsoever. I'm entirely new at making extensions/apps. And full explanation is needed.

I realize this post is quite old, but I figure some input might help for anyone having troubles with this still.

There are actually a few different reasons this could be happening.

This could possibly be due to security measures that are built into your browser (Chrome in this case) that block Javascript scripts from loading/running.

Another possibility may be that there are errors in your JS. A quick and easy way to check is to use jsfiddle.net

If you are still not getting anywhere something that usually helps me is to put the JS code directly inside a script tag in the html code:

<html>
<head>
    <script>
        // JS code here
    </script>
    <link rel="stylesheet" type="text/css" href="css/design.css"/>
    <link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
</body>
</html>

Hopefully something here can give you some results, or a direction to head in!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM