Skip to content

Instantly share code, notes, and snippets.

@firedfox
Created June 28, 2012 06:20
Show Gist options
  • Save firedfox/3009481 to your computer and use it in GitHub Desktop.
Save firedfox/3009481 to your computer and use it in GitHub Desktop.
phantomjs history.back
var flag = false;
var page = require('webpage').create();
page.onLoadFinished = function() {
flag = !flag;
if (flag) {
console.log('jump to google');
page.evaluate(function() {
window.location.href = 'http://www.google.com/';
});
} else {
console.log('go back');
page.evaluate(function() {
window.history.back();
});
}
}
page.open('http://www.bing.com/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment