i have web app called vane (link). works on phone (samsung s3) , devices, in devices loads html part no js no css..
any reason why? first app , don't know of java.. pictures:
this how should work (samsung s3)
and how looks in other devices, html (xtouch phone)
webview code:
package com.expedyte.vane; import android.app.activity; import android.content.context; import android.os.bundle; import android.webkit.geolocationpermissions; import android.webkit.webchromeclient; import android.webkit.webview; import android.webkit.webviewclient; import android.webkit.webstorage; public class iweather extends activity { public class geowebviewclient extends webviewclient { @override public boolean shouldoverrideurlloading(webview view, string url) { // when user clicks hyperlink, load in existing webview view.loadurl(url); return true; } } public class geowebchromeclient extends webchromeclient { @override public void ongeolocationpermissionsshowprompt(string origin, geolocationpermissions.callback callback) { callback.invoke(origin, true, false); } } webview mwebview; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_iweather); webview mwebview = (webview) findviewbyid(r.id.web_engine); mwebview.getsettings().setdomstorageenabled(true); mwebview.getsettings().setappcacheenabled(true); mwebview.getsettings().setdatabaseenabled(true); string databasepath = this.getapplicationcontext().getdir("database",context.mode_private).getpath(); mwebview.getsettings().setdatabasepath(databasepath); mwebview.setwebviewclient(new geowebviewclient()); // below required geolocation mwebview.getsettings().setjavascriptenabled(true); mwebview.getsettings().setgeolocationenabled(true); mwebview.setwebchromeclient(new geowebchromeclient() { public void onexceededdatabasequota(string url, string databaseidentifier, long currentquota, long estimatedsize, long totalusedquota, webstorage.quotaupdater quotaupdater) { quotaupdater.updatequota(5 * 1024 * 1024); } }); mwebview.loadurl("file:///android_asset/www/weather/index.html"); } }
html code:
<!doctype html> <html> <head> <link rel="shortcut icon" href="/vane/we.ico" type="image/x-icon" /> <link rel="stylesheet" href="swiper.css"> <link rel="stylesheet" href="style.css?1"> <link href='http://fonts.googleapis.com/css?family=open+sans:400,300,600' rel='stylesheet'> <script src="jquery.js"></script> <script src="plugins.js"></script> <script src="script.js"></script> <script src="http://maps.googleapis.com/maps/api/js?key=aizasycaf3xp-29k7vdixw4pzuu4wmtram7t-ra&sensor=false"></script> <meta name="viewport" content="initial-scale=1, user-scalable=no"> </head> <body> <div id="loader"><img src="load.png"></div> <div id="weather"> <div class="swiper-container swiper-1" id="mainswipe"> <div class="swiper-wrapper"> <div class="swiper-slide ordinary"> <div class="swiper-container swiper-2"> <div class="swiper-wrapper" id="scroller"> </div> </div> </div> <div class="swiper-slide ordinary" id="places_main"> <div class="card"> <input type="text" class="search" id="search" onclick="if(this.value=='enter place.'){this.value=''; this.select()} else {this.select()}" value="enter place."></input><div class="go" onclick="addplace()">+</div> <div id="placeholder"> <div class="swiper-container places"> <div class="swiper-wrapper" id="places"> </div> </div> </div> </div> </div> </div> </div></div> <div id="rate"> <div id="rate_title">rate us</div> <div id="rate_content">show how love app rating on app store. thank checking out.</div> <a href="http://itunes.apple.com/webobjects/mzstore.woa/wa/viewcontentsuserreviews?id=630139527&pagenumber=0&sortordering=1&type=purple+software&mt=8"><div class="button confirm">rate us</div></a> <div class="button remind" onclick="$('#rate').fadeout()">remind me later</div> <div class="button never" onclick="never_again()">never ask me again</div> </div> <div id='alertbox'> <div id='alertheader'>alert</div> <div id='alertcontent'> <div></div> </div> <div class='close' onclick='cancelalert()'>close</div> </div> <div id="info"> <div class="half"> <div id="header"><div id="back" onclick="hide_info()">back</div>about</div> <div id="video"> <iframe src="http://www.youtube.com/embed/klbyrpiz5-4" frameborder="0" allowfullscreen></iframe> </div> </div> <div id="scroller"> <div class="setting"> <div class="label">unit</div> <div id="unit">c</div><div class="degree">º</div> <div class="switch" onclick="changeunit()"><div id="toggle"></div></div> </div> </div> </div> </body> </html>
there known bug in file protocol few android versions. if referencing files url parameters http 404 (file not found) occurs , file not loaded.
in case "style.css?1" not loded.
overcoming honeycomb , ice cream sandwich’s broken webview urls
Comments
Post a Comment