jimmy
jimmy

Reputation: 1413

Can another application launch popup when user is browsing

My company has a need to display a warning popup in the browser if employee visits URLs with their Android phone that are in the deemed "dangerous". Not my idea and I don't particularly agree but my job is to research for solution.

I think there's two major questions I would appreciate answer for: 1) Is there a way to monitor URLs visited (1-2sec polling is probably acceptable)? 2) Can background app initiate popup in the browser or inject into DOM?

Upvotes: 0

Views: 85

Answers (1)

RvdK
RvdK

Reputation: 19800

If you create a custom browser, an Activity with a WebView, you will get the URLs loaded and do some action based on that.

mWebView.setWebViewClient(new WebViewClient() {         
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {

        if (isDangerous(url)) {
            //show some dialog
        }               
        mWebView.loadUrl(url);

        return true;
    }
});

Upvotes: 1

Related Questions