Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
Wrong redirect on js

Hi im trying to make chrome extension and im stuck at point that script redicrect me to wrong site.

manifest.json

  "name": "Popup ",
  "manifest_version": 2,
  "version": "0.1",
  "description": "Search for something",
  "browser_action": {
    "default_icon": "questionn.png",
    "default_popup": "popup.html"
  },

  "permissions": [
    "tabs",
    "http://*/*",
    "https://*/*"
  ]
}

popup.html

<html>
<head>
    <script src="popup.js"></script>
    <style type="text/css" media="screen">
        body {
            min-width: 250px;
            text-align: center;
        }

        #click-me {
            font-size: 15px;
        }
    </style>
</head>
<body>
    <input type="text" id="rest">
    <button id='click-me'>Click Me! </button> 
</body>
</html>

popup.js

function clickHandler(e) {
    chrome.tabs.create({ url: "www.youtube.com/watch?v=" + document.getElementById('rest').value });
    window.close(); // Note: window.close(), not this.close()
}

document.addEventListener('DOMContentLoaded', function () {
    document.getElementById('click-me').addEventListener('click', clickHandler);

});

When I'm adding "cCoed5Oo_J4" in searchbox it redirects me to "chrome-extension://lldddgdjlmoagiokneclpnhbcamggdnf/www.youtube.com/watch?v=cCoed5Oo_J4" instead of correct site. Can you guys please help me on that?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!