문제

I use a Android WebView to display a URL, which holds a image gallery, with a kind of lightbox feature to show images in detail using Javascript.

When I call this URL in the Browser App. It loads fine, and works as expected. But when I load the same URL in a WebView of a Android App, the image overview gets loaded, but when I tap on a image to get the lightbox up, it does not show.

WebView webView = (WebView) rootView.findViewById(R.id.fragment_image_detail_webview);
        String imageDetailUrl = getResources().getString(R.string.json_page_url) + imageGallery.get("detailLink");
        webView.loadUrl(imageDetailUrl);

        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new InsideWebViewClient());

So JavaScript should be enabled. The Apps internal browsers seems to behave differntly than the App Browser!?

Any ideas, on how I could narrow down the errror?

Thanks

도움이 되었습니까?

해결책 3

In the end all the suggested solutions didn't work for me. So I implemented a native image gallery for the image. I used this tutorial Fullscreen Image Slider as a reference for building my own one. Works out pretty sweet.

다른 팁

         wv = (WebView)findViewById(R.id.webView1);
      WebSettings webSettings = wv.getSettings();

        wv.getSettings().setJavaScriptEnabled(true);
        wv.getSettings().setBuiltInZoomControls(true);



        wv.loadUrl("http://www.accelfrontline.com");

Try this code hope this will be useful..

Try adding these lines to onCreate()

super.init();
WebView webView=new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
//Add these lines according to your requirements
webView.getSettings().setDomStorageEnabled(true);       
webView.getSettings().setSaveFormData(true);
webView.getSettings().setAllowContentAccess(true);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setAllowFileAccessFromFileURLs(true);
webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
//webView.getSettings().setSupportMultipleWindows(true);        
webView.getSettings().setSupportZoom(true);     
webView.setWebViewClient(new WebViewClient());
webView.setClickable(true);
webView.setWebChromeClient(new WebChromeClient());      
webView.loadUrl("Your webpage link");          
setContentView(webView);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top