model/window Cotonic

The window model can be used open and close windows.

post/open

Open a window. The payload of the message can be set t

href
The url of the window. See below.
data-window
A JSON string containing properties described below.
Or
url
The url of the page to open.
name
Specifies the target attribute of the window.
_blank
opens a new window.
_parent
loads the url in the parent window.
_self
replaces the current page.
_top
replaces any frameset that maybe loaded.
name
the name of the window to load.
width
The width of the window in pixels.
height
The height of the window in pixels.
toolbar
Wether or not to display the browsers toolbar.
scrollbars
Wether or not to display scrollbars.
status
Wether or not to add a status bar.
resizable
Wether or not the window is resizable.
location
Wether or not to display the address field.
menubar
Wether or not to display the menubar.
centerBrowser
Indicate wether or not to center the new window on top of the current active browser window.
centerScreen
Indicate wether or not to center the new window on the screen.
top
The top position of the window.
left
The left position of the window.
<a href="https://example.com/logon"
   class="btn btn-social"
   data-onclick-topic="model/window/post/open">Logon in with Example.com</a>
   data-window="{'centerBrowser': true}"
==> The click on the link publishes is window open message which will open
    a centered logon window.
self.publish("model/window/post/open", {url: "https://example.com/logon",
                                        centerBrowser: true})
==> A worker opens a logon window.

post/close

Open a window.

<a href="#" class="btn btn-default"
      data-onclick-topic="model/window/post/close"> Close Window <a>
==> Closes the current window.

Edit on GitHub