Show Popwindow does not work for me

Hello,

I am completely new for Add-on development.

I am trying to open the Popup window using button click event.

But I am not able to achieve it.

Below is the code I am trying.

var buttons = require('sdk/ui/button/action');

var button = buttons.ActionButton({
  id: "mozilla-link",
  label: "Visit Mozilla",
  icon: {
     "16": "./16x16.png"
  },
  onClick: handleClick
});

function handleClick(state) {
    var { openDialog } = require('sdk/window/utils');
    var window = openDialog({url:'http://www.google.com/'}, {
        name: 'jetpack window',
        features: Object.keys({
            width: 200,
            height: 200,
            resizable: true,
            scrollbars: true
        }).join()
    });
}

I am getting following message in Command window

JPM [info] Creating a new profile
[GFX1-]: Invalid size in UpdateRenderTarget Size(0,0)

Could you please help me with this issue?
Also let me know any suggestion about opening Popup window with specific size.

Regards
Ashish

You have 2 problems:

  1. openDialog() takes a single object as a parameter, not 2 separate objects as you’re passing.

  2. your Object.keys({…}).join() call is only including the object’s keys, which means you’re ending up with a features string of “width,height,resizable,scrollbars” (no width and height values).

Try this:

var window = openDialog({url:'http://www.google.com/',
    name: 'jetpack window',
    features: 'width=200,height=200,resizable,scrollbars'
});

Thanks Azitnay!!

This worked for me… :smile:

Where can I find samples for creating add-on?