Skip to content

Commit

Permalink
Open url (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoseppan authored and philippjfr committed Sep 24, 2019
1 parent c5695b2 commit 1586e3e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/user_guide/Links.ipynb
Expand Up @@ -352,6 +352,27 @@
"text_input.value=\"Markdown display\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Open URL\n",
"\n",
"As an example of using `jslink`, here we open a URL from the ``TextInput`` widget value. A new browser tab will open with the provided URL:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"button = pn.widgets.Button(name='Open URL', button_type = 'primary')\n",
"url = pn.widgets.TextInput(name='URL', value = 'https://pyviz.org/')\n",
"button.jslink(url, code={'clicks': 'window.open(target.value)'})\n",
"pn.Row(url, button)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 1586e3e

Please sign in to comment.