Created
September 21, 2015 15:28
-
-
Save matsuhisa/88e8f8cf68b7be85babd to your computer and use it in GitHub Desktop.
ユーザーエージェントをiPhoneにしてみるPhantomJS の例。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = 'http://www.yahoo.co.jp/'; | |
var page = require('webpage').create(); | |
page.settings.userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_0 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13A344 Safari/601.1'; | |
page.open(url, function() { | |
page.render('screen.png'); | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment