webkit - Disable subframes(iframes) loading in PhantomJs/QtWebKit -
is there way disable loading subframes in phantomjs or qtwebkit/webkit in general? have no problem massing bit source code if necessary. i'm doing web manipulation don't need contents of iframes, slows down loading time.
i know can done in mozilla example.
websetup->setproperty(nsiwebbrowsersetup::setup_allow_subframes,pr_true);
but far didn't find in qtwebkit this.
maybe there's way using onresourcerequested block requests iframes ?
this seems work:
// load main page, no iframes page.onloadstarted = function() { page.navigationlocked = true; };
could unlock again after page loads, if necessary.
alternatively, can use block loading resources:
var req_count = 0; page.onresourcerequested = function(requestdata, networkrequest) { if (req_count++ > 0) { networkrequest.abort(); } }
see also:
http://phantomjs.org/api/webpage/handler/on-resource-requested.html http://newspaint.wordpress.com/2013/04/03/adblock-for-phantomjs/
Comments
Post a Comment