1

I am new to Chrome Extensions. I have a very basic extension where I pop up a single search field html form where a user enters their name, hits a go button and it searches the corporate directory.

The code works fine if I run it directly, however when I load it in as a chrome extension, it doesn't execute the button. I separated the html and js as it recommended.

Here is my manifest.json

{
"manifest_version": 2,
"name": " People Search",
"description": "Searches the People Application",
"version": "1.0",
"browser_action": {
"default_icon": "xxx.png",
"default_popup": "popup.html"
 },
"permissions": [
"tabs"

 ]

Here is the popup.html form code.

<form>Name: <input type="text" name="firstname" id="firstname">
<input type="submit" value="Go" 
onclick="goNewPeople(document.getElementById('firstname').value)">
</form>

here is the popup.js

function goNewPeople(first)
{
var firstName = first.split(' ').slice(0, -1).join(' ');
var lastName = first.split(' ').slice(-1).join(' ');
var people1="https://xxx/xxx/xxx/f?p=9000:1::::::#" + firstName + "+" + lastName;
window.open(people1);
};

Am I supposed to put some sort of Chrome code to properly handle and execute? Do I need more permissions?

Thanks!!

Pius Kid
  • 9
  • 1
  • 1. browsers don't have a built-in web server so submitting an extension page only reloads it 2. inline js is forbidden by default, see [onClick within Chrome Extension not working](//stackoverflow.com/a/25721457) – wOxxOm Oct 14 '17 at 07:16

0 Answers0