Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Webview ativar javascript

Obrigado pela sua resposta amigo mas como sou iniciante to boiando nesse texto que eu já ate tinha visto mas não sei onde colocar esses códigos.

Em terça-feira, 28 de julho de 2015 19:16:19 UTC-3, Marcelo H escreveu:
Por padrão javascript é desabilitado na webview.

http://developer.android.com/guide/webapps/webview.html

Enabling JavaScript

JavaScript is disabled in a WebView by default. You can enable it through the WebSettings attached to your WebView. You can retrieve WebSettings with getSettings(), then enable JavaScript with setJavaScriptEnabled().

For example:

WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings
.setJavaScriptEnabled(true);

WebSettings provides access to a variety of other settings that you might find useful. For example, if you're developing a web application that's designed specifically for the WebView in your Android application, then you can define a custom user agent string with setUserAgentString(), then query the custom user agent in your web page to verify that the client requesting your web page is actually your Android application.



Em 28 de julho de 2015 18:57, Pedro horlando <xva...@gmail.com> escreveu:
Olá amigos tudo bem!
Bom gostaria da ajuda de você para resolver um problema com um webview que estou fazendo onde o site tem vários videos e de play de diferentes site, porem o sempre pede para ativar javascript como mostra na foto abaixo ate a parte do flash já resolve mas esse javascript ta osso.


Meu arquivo MainActivity esta assim:


import android.app.Activity;

import android.os.Bundle;

import android.view.Gravity;

import android.view.View;

import android.view.ViewGroup.LayoutParams;

import android.webkit.WebView;

import android.webkit.WebViewClient;

import android.widget.FrameLayout;

import android.widget.ProgressBar;

import android.graphics.Bitmap;


public class MainActivity extends Activity {

    

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        

        final ProgressBar pb = new ProgressBar(this);

        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

        lp.gravity = Gravity.CENTER;

        pb.setLayoutParams(lp);

        

        final FrameLayout fl = (FrameLayout) findViewById(R.id.frameLayout);

        

        final WebView wv = (WebView) findViewById(R.id.webView);

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

    

    

        wv.setWebViewClient(new WebViewClient(){

            @Override

            public void onPageStarted(WebView view, String url, Bitmap favicon){

                /*ProgressBar pb = (ProgressBar) findViewById(R.id.progress);

                pb.setVisibility(View.VISIBLE);*/

                fl.addView(pb);

            }

            

            @Override

            public void onPageFinished(WebView view, String url){

                //ProgressBar pb = (ProgressBar) findViewById(R.id.progress);

                //pb.setVisibility(View.INVISIBLE);

                fl.removeView(pb);

                wv.setVisibility(View.VISIBLE);

            }

        });

    }

}




Obrigado a todos

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
                                              - Marcelo Henrique -

  "Se não puder se destacar pelo talento, vença pelo esforço." (Dave Weinbaum).
              "Mate o pecado antes que ele o mate." ( Richard Baxter ).

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário