In [1]:
%%HTML
<p>hello world</p>
In [2]:
%%writefile foo.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Team X</title>
</head>
<body>
<h1>Team X</h1>
<p>We are Team X.</p>
<ul>
<li>Art</li>
<li><a href="http://www.thesimpsons.com/">Bart</a></li>
<li>Cara</li>
</ul>
</body>
</html>
In [3]:
%%js
alert("hello")
window.open('foo.html');
In [4]:
%%HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Team X</title>
<style>
h1 {
color: teal;
font-family: Georgia, serif;
font-size: 200%;
}
p {
color: blue;
}
ul {
padding-left: 100px;
list-style-type: circle;
}
li {
color: rgb(18,52,86);
}
</style>
</head>
<body>
<h1>Team X</h1>
<p>We are Team X.</p>
<ul>
<li>Art</li>
<li><a href="http://www.thesimpsons.com/">Bart</a></li>
<li>Cara</li>
</ul>
</body>
</html>
In [30]:
h1 {
color: teal;
font-family: Georgia, serif;
font-size: 200%;
}
p {
color: blue;
}
ul {
padding-left: 100px;
list-style-type: circle;
}
li {
color: rgb(18,52,86);
}
In [6]:
import webbrowser
# generate a URL
url = 'https://www.google.com'
webbrowser.open(url)
Out[6]:
In [7]:
%pycat foo.html
In [6]:
from IPython.display import Javascript
def window_open(url):
display(Javascript('window.open("{url}");'.format(url=url)))
window_open('foo.html')
In [4]:
import IPython
url = "https://staffwww.dcs.shef.ac.uk/people/S.Maddock/index.shtml"
iframe = '<iframe src=' + url + ' width=700 height=350></iframe>'
IPython.display.HTML(iframe)
Out[4]:
In [41]:
import webbrowser
webbrowser.open("https://www.google.co.uk")
Out[41]:
In [31]:
import webbrowser
webbrowser.get().name
Out[31]:
In [42]:
import webbrowser
webbrowser.open("https://i.notebooks.ai/i/GbtaKl")
Out[42]:
In [3]:
import IPython
url = "https://codepen.io/stevemaddock/pen/YozmVE"
iframe = '<iframe src=' + url + ' width=700 height=350></iframe>'
IPython.display.HTML(iframe)
Out[3]:
In [8]:
from IPython.display import Javascript
def window_open(url):
display(Javascript('window.open("{url}");'.format(url=url)))
window_open('https://codepen.io/stevemaddock/pen/YozmVE')
In [ ]: