curl != casperjs ? - Google Groups

本文探讨了curl和casperjs在处理包含JavaScript的Twitter页面时的不同表现,解释了它们在执行HTTP请求和响应方面的区别,并提出使用移动网站作为解决跨浏览器渲染差异的方法。

curl != casperjs ? - Google Groups

Hello,

This is because twitter renders the page differently for a browser the supports javascript (casperjs) versus one that does not (curl). Curl does not execute javascript, it only handles raw http requests and responses. Casperjs on the other hand is an interface to a GUI-less browser and executes events just like a browser.
Casperjs is based on PhantomJS & QT Webkit, so it is similar to Chrome. This means you can test any evaluate commands in a Chrome javascript console first. Oddly, in the case of your example I noticed the result for twitter on Chrome was still different than Casperjs. Caserpjs could not render the inner frames that contain the tweets.
To resolve this, you could use the mobile site, http://mobile.twitter.com/username 
Cheers,
Graeme
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值