问题
What is isForMainFrame meaning (android-21)?
whether the request was made for the main frame. Will be false for iframes, for example.
is not clear, since for the log below it returns false
for main frame requests.
Is it the same as isMainFrame in android-19?
For "google.com" (which is immediately redirected to "google.ru" according to my locale) i'm getting the following log for android-19:
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=true for http://www.google.com/
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://ssl.gstatic.com/gb/images/qi2_00ed8ca1.png
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_160x56dp.png
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.google.ru/images/nav_logo242_hr.png
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.gstatic.com/og/_/js/k=og.mob.en_US.p8Smm-clGwA.O/rt=j/m=md/exm=mih,mab,meb/d=1/ed=1/rs=AA2YrTsvrSisM1LDBap6j28t9xwsb4oJBg
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.google.ru/xjs/_/js/k=xjs.qs.ru.WqzjCT34eOw.O/m=sx,c,sb_mob,bct,cdos,elog,hsm,jsa,mbsf,r,qsm,d,csi/am=AIG2TGBhALBBYgn5FBACKAE/rt=j/d=1/t=zcms/rs=ACT90oHeC71MlDyUp6g3gXk23kbF4ygyvw
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.google.ru/xjs/_/js/k=xjs.qs.ru.WqzjCT34eOw.O/m=sy7,sy13,em2,sy12,aa,abd,sy55,sy54,sy53,sy57,em10,async,sy280,sy320,sy319,dvl,sy425,foot,ipv6,shm/am=AIG2TGBhALBBYgn5FBACKAE/rt=j/d=0/t=zcms/rs=ACT90oHeC71MlDyUp6g3gXk23kbF4ygyvw
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.google.ru/images/branding/product/ico/googleg_lodp.ico
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.google.ru/images/nav_logo242.png
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.google.ru/gen_204?v=3&s=mobilewebhp&atyp=csi&ei=7kT-V-OSNcOfsgHEgL2gAw&imc=1&imn=1&imp=1&adh=&xjs=init.251.13.sb_mob.199.dvl.23.c.8.async.6.jsa.5&ima=1&rt=xjsls.161,prt.164,iml.716,dcl.574,xjses.1086,xjsee.1535,xjs.1536,ol.1873,aft.716,wsrt.1937,cst.728,dnst.1,rqst.219,rspt.36,sslt.721,rqstt.1645,unt.862,cstt.916,dit.2155
3068-3088 D/IoThreadClientInvocationHandler: isMainFrame=false for https://www.gstatic.com/og/_/ss/k=og.mob.-1m1er1bg50qhy.L.W.O/m=md/excm=mih,mab,meb/d=1/ed=1/rs=AA2YrTuS2ZHRm9kj5jyes52ZN2R47G8RQQ
for android-21 i can see:
1725-1851 D/IoThreadClientInvocationHandler: 21: true for http://www.google.com/
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_160x56dp.png
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://ssl.gstatic.com/gb/images/qi2_00ed8ca1.png
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.google.ru/images/nav_logo242_hr.png
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.gstatic.com/og/_/js/k=og.mob.en_US.p8Smm-clGwA.O/rt=j/m=md/exm=mih,mab,meb/d=1/ed=1/rs=AA2YrTsvrSisM1LDBap6j28t9xwsb4oJBg
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.google.ru/xjs/_/js/k=xjs.qs.ru.WqzjCT34eOw.O/m=sx,c,sb_mob,bct,cdos,elog,hsm,jsa,mbsf,r,qsm,d,csi/am=AIG2ZGBhALBBYgn5FBACKAE/rt=j/d=1/t=zcms/rs=ACT90oGqh459Mg-Bg7N2WXgWV78Tvd2J1A
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.google.ru/xjs/_/js/k=xjs.qs.ru.WqzjCT34eOw.O/m=sy7,sy13,em2,sy12,aa,abd,sy55,sy54,sy53,sy57,em10,async,sy280,sy320,sy319,dvl,sy425,foot,ipv6,shm,udlg/am=AIG2ZGBhALBBYgn5FBACKAE/rt=j/d=0/t=zcms/rs=ACT90oGqh459Mg-Bg7N2WXgWV78Tvd2J1A
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.google.ru/images/nav_logo242.png
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.google.ru/gen_204?v=3&s=mobilewebhp&atyp=csi&ei=Qkb-V4-7AoOisAGdzq24Bg&imc=1&imn=1&imp=1&adh=&xjs=init.181.13.sb_mob.151.c.12.mbsf.4.jsa.4.async.4&conn=unknown&ima=1&rt=xjsls.146,prt.155,iml.4995,dcl.4791,xjses.5597,xjsee.6069,xjs.6070,ol.6264,aft.4995,wsrt.1045,cst.155,dnst.0,rqst.127,rspt.9,sslt.147,rqstt.837,unt.671,cstt.681,dit.1305
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.gstatic.com/og/_/ss/k=og.mob.-1m1er1bg50qhy.L.W.O/m=md/excm=mih,mab,meb/d=1/ed=1/rs=AA2YrTuS2ZHRm9kj5jyes52ZN2R47G8RQQ
1725-1851 D/IoThreadClientInvocationHandler: 21: false for https://www.google.ru/images/branding/product/1x/gsa_shadowed_144dp.png
I expected to see true
for all the resources since it's the resources from the main (and single) frame at "google.ru". Am i wrong?
回答1:
The isForMainFrame
method is actually inherited from WebKit. For instance, here is in the Apple docs
Thus, here MainFrame refers to the WebKit concept, which is the root WebFrame.
Behind the scenes, WebFrame objects encapsulate the content contained in a single frame element. A hierarchy of WebFrame objects is used to model an entire webpage where the root is called the main frame
You can find more on that in the docs
By this definition, only the initial request is for the "main frame", the rest are requests for the children WebFrames.
来源:https://stackoverflow.com/questions/40000939/what-is-isformainframe-request-in-android-webviewclient-property-meaning