phantomjs/release-1.6.html

177 lines
6.7 KiB
HTML
Executable File

<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>PhantomJS 1.6 Release Notes</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="screen.min.css">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-21665893-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<style>
#description p {
line-height: 125%;
text-align: left;
margin-bottom: 10px;
margin-top: 10px;
}
#description h2 {
text-align: left;
margin: 0.8em 0;
font-size: 150%;
}
#description pre {
margin-left: 2em;
}
#description ul {
line-height: 125%;
list-style-type: disc;
margin-left: 1em;
margin-bottom: 1em;
}
#description li {
margin-left: 1em;
}
</style>
</head>
<body>
<div id="intro">
<div id="header" class="container_12">
<a href="index.html" class="grid_4 alpha"><img src="images/phantomjs-logo.png" alt="PhantomJS" id="logo" width="240" height="80"></a>
<ul id="nav" class="grid_8 omega">
<li><a href="https://github.com/ariya/phantomjs">Source Code</a></li>
<li><a href="https://github.com/ariya/phantomjs/wiki">Documentation</a></li>
<li><a href="https://github.com/ariya/phantomjs/wiki/API-Reference">API</a></li>
<li><a href="https://github.com/ariya/phantomjs/wiki/Examples">Examples</a></li>
<li><a href="faq.html">FAQ</a></li>
</ul>
</div>
<div id="introduction" class="container_12">
<div class="grid_7 alpha">
<h1>PhantomJS 1.6 Release Notes</h1>
</div>
</div>
</div>
<div id="description" class="container_12">
<div class="grid_10">
<p>PhantomJS 1.6, <em><a href="release-names.html">Lavender</a></em>, was released on June 20, 2012. It is a minor update, mostly bug fixes and some new API.</p>
<p>This version is backward compatible with version 1.5. Existing scripts should work without any modification.</p>
<p><strong>Improved support for rendering</strong></p>
<p>While it is always possible to capture the web page and render it as an image, it involves creating an external file to hold that image. With this version, the captured content can be retrieved as a string, base64-encoded using the new renderBase64(format) function.</p>
<p>The example will dump the base64-encoded rendering of the web page in PNG format (the default if no format is specified) to the terminal:</p>
<pre>
var page = require('webpage').create();
page.open('http://m.bing.com', function (status) {
console.log(page.renderBase64());
phantom.exit();
});
</pre>
<p>To facilitate creating thumbnail preview, scaling the screen capture is now possible via the new zoomFactor property. In this example, the BBC site is captured to an image at 25% zoom.</p>
<pre>
var page = require('webpage').create();
page.open('http://news.bbc.co.uk', function (status) {
page.zoomFactor = 0.25;
page.render('bbc.png');
phantom.exit();
});
</pre>
<p><strong>Better script evaluation</strong></p>
<p>Arguments can be passed to evaluate() function to run a script in the context of the web page.</p>
<p>In the following example, the text value of a DOM element is extracted. The element is chosen based on the selector which is passed to evaluate.</p>
<pre>
var page = require('webpage').create();
page.open('http://m.bing.com', function (status) {
var title = page.evaluate(function (s) {
return document.querySelector(s).innerText;
}, 'title');
console.log(title);
phantom.exit();
});
</pre>
<p>Evaluating a script asynchronously is now possible via the new evaluateAsync function. Unlike the standard evaluate, the function returns immediately and does not wait until the script execution finishes. Consequently there is no return value from this function.</p>
<p><strong>New features</strong></p>
<ul>
<li>Added support for passing arguments to WebPage's evaluate (issue 132)
<li>Added callbacks for JavaScript onConfirm and onPrompt (issue 133)
<li>Added stack trace when error occurs (issue 166)
<li>Added initial support for cookies handling (issue 354)
<li>Added support for header footer when printing the page (issue 410, 512)
<li>Added headers support in the loading request (issue 452)
<li>Added support to render the web page as base64-encoded string (issue 547)
<li>Added hooks for navigation event (issue 562)
<li>Added command-line option to show debug messages (issue 575)
<li>Added support for the zoom factor for web page rendering (issue 579)
<li>Added crash reporter for Mac OS X and Linux, based on Google Breakpad (issue 576)
<li>Added 'os' object to the system module (issue 585)
<li>Added support for asynchronous evaluation (issue 593)
</ul>
<p><strong>Improvements</strong></p>
<ul>
<li>Fixed remote debugging to work on Mac OS X and Windows (issue 430)
<li>Fixed web server getting the dropped connection for empty response (issue 451)
<li>Fixed text rendered as boxes (squares) on headless Linux (issue 460)
<li>Updated Qt to version 4.8.2 (issue 495)
<li>Updated CoffeeScript compiler to version 1.3.3 (issue 496)
<li>Fixed the build script to detect and use MAKEFLAGS (issue 503)
<li>Fixed the build script to properly pass Qt config flags (issue 507)
<li>Changed Info.plist to be embedded in Mac OS X executable (issue 528)
<li>Fixed wrong module require in the imagebin example (issue 536)
<li>Fixed example scripts to exit with the right exit code (issue 544)
<li>Fixed build failure with glib 2.31.0+ (issue 559)
<li>Fixed error handler failures in some cases (issue 589)
</ul>
<p>Back to <a href="releases.html">all releases</a>.</p>
</div>
</div>
<div id="footer">
<div id="footer-content" class="container_12">
<p>
&copy; Copyright 2010-2012 <a href="http://twitter.com/AriyaHidayat">Ariya Hidayat</a> &mdash; Website design by <a href="http://svay.com/">Maurice Svay</a>
</p>
</div>
</div>
</body>
</html>