Re: [android-developers] Re: webview client, that intercepts img requests on API 8

2012-08-06 Thread Kristopher Micinski
Yes, but implementing this proxy would require rooting the device.
For the second question you're asking, I had hoped to imply that this
was my plan, and the answer is that I believe you cannot do so.

kris

On Mon, Aug 6, 2012 at 4:54 PM, Gelonida N gelon...@gmail.com wrote:
 Hi Chris,


 On 08/06/2012 01:33 AM, Kristopher Micinski wrote:

 I doubt it, I tried to find a way to proxy traffic, but there's no
 easy hook.  I.e., if you need something that is in 11 and you're on 8
 you're just plain out of luck.

 There is one solution, but implementing it accurately would be dumb
 because of how much ajax stuff (and related) there is now: you can
 look at the HTML statically, pull out the image tags, and render the
 page yourself... There obviously isn't an easy way to do this, so this
 answer is as good as rewrite webkit.


 Hmm an alternative would be implementing a filtering web proxy. Much more
 complicated, but perhaps doable.
 Is there any way, that I can create an application, that would use a webview
 with it's custom proxy, whereas the normal browser (or other web views)
 would just use the default proxy setup (which is in my case 'no proxy')



 On Sun, Aug 5, 2012 at 6:15 PM, Gelonida N gelon...@gmail.com wrote:

 I'm having an HTC desire (Android2.2.2 Froyo API 8)
 and  I wanted to create a custom browser (using WebViewclient), that
 intercepts some url requests (img tags) and skips loading these images.

 public WebResourceResponse shouldInterceptRequest (WebView view, String
 url)
 seems to be what I need.

 However I'm only on API 8 and the function has been introduced on API 11.

 Is there any way to do what I want to do with API 8

 My phone is supposed to be updatable to Gingerbread, but that brings me
 only
 to API 9 (or 10) and still not to 11.




 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: webview client, that intercepts img requests on API 8

2012-08-06 Thread Kostya Vasilyev
2012/8/7 Kristopher Micinski krismicin...@gmail.com

 Yes, but implementing this proxy would require rooting the device.


Not necessarily - if the WebView is under the developer's control (i.e.
there is no intention to do this system-wide), then it should be possible
to feed the WebView a URL that refers to a server running on localhost (as
part of the same app).

-- K

For the second question you're asking, I had hoped to imply that this
 was my plan, and the answer is that I believe you cannot do so.

 kris

 On Mon, Aug 6, 2012 at 4:54 PM, Gelonida N gelon...@gmail.com wrote:
  Hi Chris,
 
 
  On 08/06/2012 01:33 AM, Kristopher Micinski wrote:
 
  I doubt it, I tried to find a way to proxy traffic, but there's no
  easy hook.  I.e., if you need something that is in 11 and you're on 8
  you're just plain out of luck.
 
  There is one solution, but implementing it accurately would be dumb
  because of how much ajax stuff (and related) there is now: you can
  look at the HTML statically, pull out the image tags, and render the
  page yourself... There obviously isn't an easy way to do this, so this
  answer is as good as rewrite webkit.
 
 
  Hmm an alternative would be implementing a filtering web proxy. Much more
  complicated, but perhaps doable.
  Is there any way, that I can create an application, that would use a
 webview
  with it's custom proxy, whereas the normal browser (or other web views)
  would just use the default proxy setup (which is in my case 'no proxy')
 
 
 
  On Sun, Aug 5, 2012 at 6:15 PM, Gelonida N gelon...@gmail.com wrote:
 
  I'm having an HTC desire (Android2.2.2 Froyo API 8)
  and  I wanted to create a custom browser (using WebViewclient), that
  intercepts some url requests (img tags) and skips loading these
 images.
 
  public WebResourceResponse shouldInterceptRequest (WebView view, String
  url)
  seems to be what I need.
 
  However I'm only on API 8 and the function has been introduced on API
 11.
 
  Is there any way to do what I want to do with API 8
 
  My phone is supposed to be updatable to Gingerbread, but that brings me
  only
  to API 9 (or 10) and still not to 11.
 
 
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: webview client, that intercepts img requests on API 8

2012-08-06 Thread Kristopher Micinski
Yes, but to intercept the requests to the browser using a proxy (as
the OP suggests) requires rooting the device.

Sure, redirecting the links is one thing if you have control of the
webview, for arbitrary ajax traffic it's a no.

kris

On Mon, Aug 6, 2012 at 5:32 PM, Kostya Vasilyev kmans...@gmail.com wrote:

 2012/8/7 Kristopher Micinski krismicin...@gmail.com

 Yes, but implementing this proxy would require rooting the device.


 Not necessarily - if the WebView is under the developer's control (i.e.
 there is no intention to do this system-wide), then it should be possible to
 feed the WebView a URL that refers to a server running on localhost (as part
 of the same app).

 -- K

 For the second question you're asking, I had hoped to imply that this
 was my plan, and the answer is that I believe you cannot do so.

 kris

 On Mon, Aug 6, 2012 at 4:54 PM, Gelonida N gelon...@gmail.com wrote:
  Hi Chris,
 
 
  On 08/06/2012 01:33 AM, Kristopher Micinski wrote:
 
  I doubt it, I tried to find a way to proxy traffic, but there's no
  easy hook.  I.e., if you need something that is in 11 and you're on 8
  you're just plain out of luck.
 
  There is one solution, but implementing it accurately would be dumb
  because of how much ajax stuff (and related) there is now: you can
  look at the HTML statically, pull out the image tags, and render the
  page yourself... There obviously isn't an easy way to do this, so this
  answer is as good as rewrite webkit.
 
 
  Hmm an alternative would be implementing a filtering web proxy. Much
  more
  complicated, but perhaps doable.
  Is there any way, that I can create an application, that would use a
  webview
  with it's custom proxy, whereas the normal browser (or other web views)
  would just use the default proxy setup (which is in my case 'no proxy')
 
 
 
  On Sun, Aug 5, 2012 at 6:15 PM, Gelonida N gelon...@gmail.com wrote:
 
  I'm having an HTC desire (Android2.2.2 Froyo API 8)
  and  I wanted to create a custom browser (using WebViewclient), that
  intercepts some url requests (img tags) and skips loading these
  images.
 
  public WebResourceResponse shouldInterceptRequest (WebView view,
  String
  url)
  seems to be what I need.
 
  However I'm only on API 8 and the function has been introduced on API
  11.
 
  Is there any way to do what I want to do with API 8
 
  My phone is supposed to be updatable to Gingerbread, but that brings
  me
  only
  to API 9 (or 10) and still not to 11.
 
 
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: webview client, that intercepts img requests on API 8

2012-08-06 Thread Kostya Vasilyev
2012/8/7 Kristopher Micinski krismicin...@gmail.com

 Yes, but to intercept the requests to the browser using a proxy (as
 the OP suggests) requires rooting the device.


Feeding a WebView that's in your own app a URL like
localhost:1234?src=www.foo.bar requires rooting?

Processing the received HTML / CSS, replacing links requires rooting?



 Sure, redirecting the links is one thing if you have control of the
 webview, for arbitrary ajax traffic it's a no.


Agree - this won't work for requests dynamically generated by JS, but it
might be acceptable depending on the requirements.

-- K



 kris

 On Mon, Aug 6, 2012 at 5:32 PM, Kostya Vasilyev kmans...@gmail.com
 wrote:
 
  2012/8/7 Kristopher Micinski krismicin...@gmail.com
 
  Yes, but implementing this proxy would require rooting the device.
 
 
  Not necessarily - if the WebView is under the developer's control (i.e.
  there is no intention to do this system-wide), then it should be
 possible to
  feed the WebView a URL that refers to a server running on localhost (as
 part
  of the same app).
 
  -- K
 
  For the second question you're asking, I had hoped to imply that this
  was my plan, and the answer is that I believe you cannot do so.
 
  kris
 
  On Mon, Aug 6, 2012 at 4:54 PM, Gelonida N gelon...@gmail.com wrote:
   Hi Chris,
  
  
   On 08/06/2012 01:33 AM, Kristopher Micinski wrote:
  
   I doubt it, I tried to find a way to proxy traffic, but there's no
   easy hook.  I.e., if you need something that is in 11 and you're on 8
   you're just plain out of luck.
  
   There is one solution, but implementing it accurately would be dumb
   because of how much ajax stuff (and related) there is now: you can
   look at the HTML statically, pull out the image tags, and render the
   page yourself... There obviously isn't an easy way to do this, so
 this
   answer is as good as rewrite webkit.
  
  
   Hmm an alternative would be implementing a filtering web proxy. Much
   more
   complicated, but perhaps doable.
   Is there any way, that I can create an application, that would use a
   webview
   with it's custom proxy, whereas the normal browser (or other web
 views)
   would just use the default proxy setup (which is in my case 'no
 proxy')
  
  
  
   On Sun, Aug 5, 2012 at 6:15 PM, Gelonida N gelon...@gmail.com
 wrote:
  
   I'm having an HTC desire (Android2.2.2 Froyo API 8)
   and  I wanted to create a custom browser (using WebViewclient), that
   intercepts some url requests (img tags) and skips loading these
   images.
  
   public WebResourceResponse shouldInterceptRequest (WebView view,
   String
   url)
   seems to be what I need.
  
   However I'm only on API 8 and the function has been introduced on
 API
   11.
  
   Is there any way to do what I want to do with API 8
  
   My phone is supposed to be updatable to Gingerbread, but that brings
   me
   only
   to API 9 (or 10) and still not to 11.
  
  
  
  
   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to
 android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: webview client, that intercepts img requests on API 8

2012-08-06 Thread Kristopher Micinski
On Mon, Aug 6, 2012 at 5:46 PM, Kostya Vasilyev kmans...@gmail.com wrote:
 2012/8/7 Kristopher Micinski krismicin...@gmail.com

 Yes, but to intercept the requests to the browser using a proxy (as
 the OP suggests) requires rooting the device.


 Feeding a WebView that's in your own app a URL like
 localhost:1234?src=www.foo.bar requires rooting?

 Processing the received HTML / CSS, replacing links requires rooting?


To do it properly, and identify all of the links statically would
require a real considerable amount of analysis because of the
funkiness of HTML.  I previously suggested this approach to the OP,
but I doubt that it will work (and it just *feels* wrong), and even if
it does it's just abhorrently hacky..  So if he knows the structure of
the page, then perhaps, maybe this would be an acceptable hack, but
for the general case of writing a web browser, (as he says), hell no.

kris

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en