开发者

Prompt to download Flash from WebView goes to broken link

I have a video w开发者_开发技巧ebsite that is Android compatible. Flash is required to view videos on my site. When Flash is not installed, I display an anchor linking to http://get.adobe.com/flashplayer/ for the user to download Flash.

<a href="http://get.adobe.com/flashplayer/">
   Flash player is required to watch this video
</a>

When viewing my website through the default Browser app, this anchor correctly opens up the Flash download page in the Market app. However, when my site is loaded through a WebView and the user taps the anchor, they are sent to a 404 page:

Web page not available. The Web page at market://details?id=com.adobe.flashplayer might be temporarily down or it may have moved permanently to a new web address.

How would I make my website work for both the Browser app and any native app that loads my website through a WebView?


check this out. http://developer.android.com/guide/publishing/publishing.html#marketintent you will need to use an intent to open the market URL. Probably the easiest thing to do would be to use:

mWebView.setWebViewClient(new CustomWebViewClient());
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);    


    private class CustomWebViewClient extends WebViewClient 
    {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) 
        {    
        if(url.contains("market://"))   
        Intent intent = new Intent(Intent.ACTION_VIEW);  
        intent.setData(Uri.parse(url));
        startActivity(intent);
        }
    }

Note: I did not test this, but you should get the general idea. if it is a market url then open the market app using an intent instead of trying to load the url.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜