Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8125537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:51:10+00:00 2026-06-06T06:51:10+00:00

Hi I have run into a very weird problem. I have a basic chrome

  • 0

Hi I have run into a very weird problem.

I have a basic chrome extension which has a default popup.html document defined as follows:

<html>

<head>
  <script type="text/javascript">
    function disp() {
    document.getElementById("test").innerHTML = "Bye";
    }
  </script>
</head>

<body>

<p id="test">Hello</p>
<button type="button" onclick="disp()">'Twas Nice to meet you</button>

</body>

</html>

Upon running the html file independently in a browser, it behaves as expected: clicking on the button changes the text of the p tag. However, from withing the chrome extension, in the popup the button does not seem to respond

Is this something to do with popups in general or something specific to my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:51:12+00:00Added an answer on June 6, 2026 at 6:51 am

    Although you’ve found out you can circumvent the inline script “issue” (it is a security feature), below is what it would look like if you did not do that. This shows both how to call a notification and a “window”-based dialog.

    manifest.json

    {
      "name": "Hello World!",
      "version": "1.0",
      "manifest_version": 2,
      "description": "The first extension that I made.",
      "browser_action": {
        "default_icon": "icon.png",
        "default_popup": "popup.html"
      },
      "permissions": [
        "notifications",
        "create",
        "tabs"
      ]
    }
    

    popup.html

    <!doctype html>
    <html>
      <head>
        <title>Getting Started with Extension's Popup</title>
        <style>
          body {
            min-width:357px;
            overflow-x:hidden;
          }
          img {
            margin:5px;
            border:2px solid black;
            vertical-align:middle;
            width:75px;
            height:75px;
          }
        </style>
    
        <!-- JavaScript and HTML must be in separate files for security. -->
        <script src="popup.js"></script>
      </head>
      <body>
        <div style="text-align: center;">
            <button type="button" id="click">Show Notification</button>
            <button type="button" id="dialog">Show Dialog</button>
        </div>
      </body>
    </html>
    

    dialog.html

    <!doctype html>
    <html>
      <head>
        <title>Dialog Prompt - Chrome</title>
        <style>
        body {
          overflow: hidden;
          margin: 0px;
          padding: 0px;
          background: white;
        }
        p {
            text-align: center;
            padding: 20px;
        }
        </style>
      </head>
      <body>
        <p>This is a dialog prompt.</p>
      </body>
    </html>
    

    popup.js

    var notifier,
        dialog;
    
    function showNotify() {
        var notify;
    
        if (window.webkitNotifications.checkPermission() == 0) {
            notify = window.webkitNotifications.createNotification(
                "",
                'Notification Test',
                'This is a test of the Chrome Notification System. This is only a test.'
            );
            notify.show();
        } else {
            window.webkitNotifications.requestPermission();
        }
    }    
    function showDialog(){
        chrome.windows.create({
            url: 'dialog.html',
            width: 200,
            height: 120,
            type: 'popup'
        });
    }    
    function init() {
        clicker = document.querySelector('#click');
        dialog = document.querySelector('#dialog');
    
        clicker.addEventListener('click', showNotify, false);
        dialog.addEventListener('click', showDialog, false);
    }    
    document.addEventListener('DOMContentLoaded', init);
    

    You can find the files to download here:

    http://jfcoder.com/projects/chrometestdialogs/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently started using GNU Screen but have run into a very annoying problem.
I have run into a very interesting problem trying to debug my custom PHP
I have run into what seems to be a very famous problem: My updatepanel
Trying my hand at java and android and have run into a problem which
I just made a very simple website, but I have run into a problem.
I am a very inexperienced developer and have run into a problem that should
I have run into a very strange behaviour I can’t make sense of. I
I am modifying a wordpress theme completely, and have run into one very simple
I've been coding a very sizable project and I have run into trouble with
I have run into a problem trying to modify a form I myself have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.