Could any one help me,to find out my problem.I have set my website as chrome extension.When I install the extension,it navigates to a popup window asking user name and password
The reason it is not working is that test.html
is opened as a "view" of your extension and the Content Security Policy (CSP) prevents inline scripts and inline event-binding from being executed.
You should move the code and the event-bindings to an external JS file.
In test.html:
<html>
<head>
<script type="text/javascript" src="test.js"></script>
</head>
<body>
...
<input type="button" id="login" value="Log In" />
...
</body>
</html>
In test.js:
window.addEventListener('DOMContentLoaded', function() {
var login = document.querySelector('input#login');
login.addEventListener('click', function() {
// ...do stuff...
});
});
You have to pick up value of the input field:
var uname = document.getElementById('name').value;