Viewing and exporting source in Opera Mini
Opera Mini is one of our products available for mobile phones and tablets. It's available for iOS, Android and Symbian platforms, a range of J2ME feature phones, and other devices.
Opera Mini is a proxy browser, which means that the parsing of web pages occurs on Opera's servers, rather than the device. Opera Mini merely forwards the user's request to Opera's proxy servers and displays the OBML image that those servers send back to the user's handset or tablet.
Each request for a URL requires a request to the proxy server. That much is obvious. What's less obvious, though, is this: any interaction that changes the DOM tree also generates a request to the proxy server. Opera Mini's servers also impose execution time limits on JavaScript. As a result, some DOM changes may not complete before the server sends the result to the user.
Thankfully, Opera Mini offers the ability to inspect the current DOM tree as rendered by Opera's proxy servers. Enter server:source in the Opera Mini address bar to view the source of the currently loaded page.
Viewing the source on a device, of course, is far from ideal. That's why Opera Mini also makes it possible to export the current DOM tree's source. To do this, append a post variable containing the URL of the script: server:source?post=http://url/to/your/script.
Opera Mini will send a POST request to that URL containing three fields: url, host, and html. Your script can save the code to a database, save it as a file, or e-mail it.
To get you started, you can use this Opera Mini Export Source script. You will need a server with PHP 5.2+ and an Amazon S3 account. The script will capture the source output and save it as an object to the S3 bucket you provide.
Opera Mini is a proxy browser, which means that the parsing of web pages occurs on Opera's servers, rather than the device. Opera Mini merely forwards the user's request to Opera's proxy servers and displays the OBML image that those servers send back to the user's handset or tablet.
Each request for a URL requires a request to the proxy server. That much is obvious. What's less obvious, though, is this: any interaction that changes the DOM tree also generates a request to the proxy server. Opera Mini's servers also impose execution time limits on JavaScript. As a result, some DOM changes may not complete before the server sends the result to the user.
Thankfully, Opera Mini offers the ability to inspect the current DOM tree as rendered by Opera's proxy servers. Enter server:source in the Opera Mini address bar to view the source of the currently loaded page.
Viewing the source on a device, of course, is far from ideal. That's why Opera Mini also makes it possible to export the current DOM tree's source. To do this, append a post variable containing the URL of the script: server:source?post=http://url/to/your/script.
Opera Mini will send a POST request to that URL containing three fields: url, host, and html. Your script can save the code to a database, save it as a file, or e-mail it.
To get you started, you can use this Opera Mini Export Source script. You will need a server with PHP 5.2+ and an Amazon S3 account. The script will capture the source output and save it as an object to the S3 bucket you provide.
Readers' comments 3
Left under the original article, as archived.
About this article
| Published in | ODIN blog |
|---|---|
| Date | September 19, 2011 |
| Author | Tiffany Brown |
| Original | Internet Archive |
Yeni SetiawanMonday, September 19, 2011 8:50:03 PM
Tiffany BrownTuesday, September 20, 2011 7:35:35 PM
Originally posted by sandalian:
It should work in all recent versions of Mini. What often happens is that the page appears blank, but the code is actually in the top-left corner of the screen and you need to zoom in and scroll. An extra-long, unbroken line of HTML is usually the cause. Mini will scale the source to fit the screen size (as it does with too-wide HTML pages).
Yeni SetiawanWednesday, September 21, 2011 3:25:37 PM
Thanks Tiffany, I'll check again later