开发者

php curl getting the resources(js,css,etc) of the webpage?

开发者 https://www.devze.com 2022-12-26 14:01 出处:网络
for example when i open http://code.google.com/apis/maps/documentat开发者_开发百科ion/examples/geocoding-simple.html for the first time, it doesn\'t load all the resources right away,but it pulls extr

for example when i open http://code.google.com/apis/maps/documentat开发者_开发百科ion/examples/geocoding-simple.html for the first time, it doesn't load all the resources right away,but it pulls extra js files after it has loaded.


You'll need to grab the main HTML page and then parse it looking for external files that also need to be called. Then you would use cURL to download them separately.


If I'm understanding what you're looking for, you want to defer the loading of external resources until later. That's called lazy loading. Check out this stuff:

http://www.appelsiini.net/projects/lazyload

http://ajaxian.com/archives/a-technique-for-lazy-script-loading

CSS isn't really lazy loading because if it isn't there, the page still does its thing anyway, just in a more ugly way.

0

精彩评论

暂无评论...
验证码 换一张
取 消