| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | def iframe(self, url, height=400, width=800): |
| 301 | """ |
| 302 | Put an existing web page into a worksheet. |
| 303 | |
| 304 | INPUT: |
| 305 | |
| 306 | - ``url`` -- a url string. Either with or without "http://". |
| 307 | - ``height`` -- the number of pixels for the page height. |
| 308 | Defaults to 400. |
| 309 | - ``width`` -- the number of pixels for the page width. |
| 310 | Defaults to 800. |
| 311 | |
| 312 | OUTPUT: |
| 313 | |
| 314 | Opens the url in a worksheet. If the url is a regular web page |
| 315 | it will appear in the worksheet. This was originally intended |
| 316 | to bring GeoGebra worksheets into Sage, but it can be used for |
| 317 | many other purposes. |
| 318 | |
| 319 | |
| 320 | EXAMPLES:: |
| 321 | |
| 322 | sage: html.iframe("sagemath.org") |
| 323 | <html><font color='black'><iframe height=400 px width=800 px |
| 324 | src="http://sagemath.org"></iframe></font></html> |
| 325 | |
| 326 | sage: html.iframe("http://sagemath.org",30,40) |
| 327 | <html><font color='black'><iframe height=30 px width=40 px |
| 328 | src="http://sagemath.org"></iframe></font></html> |
| 329 | |
| 330 | sage: html.iframe("https://sagemath.org",30) |
| 331 | <html><font color='black'><iframe height=30 px width=800 px |
| 332 | src="https://sagemath.org"></iframe></font></html> |
| 333 | |
| 334 | AUTHOR: |
| 335 | |
| 336 | - Bruce Cohen (2011-06-14) |
| 337 | """ |
| 338 | if not url.startswith("http"): |
| 339 | url="http://"+url |
| 340 | string='<iframe height=%d px width=%d px src="%s"></iframe>'%(height, |
| 341 | width, |
| 342 | url) |
| 343 | return html(string) |
| 344 | |
| 345 | |