html - Android Webview not showing specific page -
i'm using webview on app load web page. other web pages working fine, 1 seems load showing blank page.
the source code of html page generated cgi , output is:
<html> <head> <meta name="viewport" content="width=device-width; height=device-height;"> <link rel="stylesheet" href="resource://gre/res/imagedocument.css"> /* * css stylesheet defines rules applied imagedocuments, * including in frames. */ @media not print { .overflowing { cursor: zoom-out; } .shrinktofit { cursor: zoom-in; } } @media print { img { display: block; } } </link> <link rel="stylesheet" href="resource://gre/res/toplevelimagedocument.css"> @media not print { body { margin: 0; } img { text-align: center; position: absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; } .completerotation { transition: transform 0.3s ease 0s; } } img { image-orientation: from-image; } </link> <link rel="stylesheet" href="chrome://global/skin/media/toplevelimagedocument.css"> filtered chrome url chrome://global/skin/media/toplevelimagedocument.css </link> <title>cgi_getimage.cgi (immagine jpeg, 640 × 480 pixel) - riscalata (86%)</title> </head> <body> <img class="shrinktofit" src="path_to_image" alt="" width="553" height="415"> </body> </html>
in app load url using settings webview:
websettings websettings = webview.getsettings(); websettings.setjavascriptenabled(true); websettings.setloadwithoverviewmode(true); websettings.setusewideviewport(true); // alstro tried without this...
i think might kind of problem css of page unfortunately can not edite output of cgi generating html.
any help?
edit:
here's how load url:
webview = (webview)findviewbyid(r.id.webviewpuntamento); webview.setwebviewclient(new puntamentowebviewclient()); webview.loadurl(geturlpuntamento());
where puntamentowebviewclient()
extension of webviewclient wich handles both basic http authentication , connection errors received server. geturlpuntamento()
returns url i'm gonna open.
fact can load , see other pages, except one. no errors , can show toast
title of loaded page, no contents.
geturlpuntamento()
returns http://user:password@host_ip:port/cgi-bin/cgi_getimage.cgi
since page require basic authentication.
in addition use webview.sethttpauthusernamepassword(host, "embedded-device", username, password);
before loading url.
and puntamentowebviewclient()
has
@override public void onreceivedhttpauthrequest(webview view, @nonnull httpauthhandler handler, string host, string realm) { handler.proceed(username, password); }
the cgi on embedded device wich try contact direct connection wifi (this connection works fine). connecting configuration page of device (same authentication, same ip, different cgi) seems work fine.
for future me (or else might fall in issue): problem cgi returned image, not html page image in it. misunderstanding araised because browser wrapped image in html page... in end there's no need use webview asynctask grab image , show it.
Comments
Post a Comment