Skip to content

Commit

Permalink
Enable JS in the phone Web view
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeerias authored and svillar committed Oct 23, 2023
1 parent a651b5b commit 231ef59
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/hvr/java/com/igalia/wolvic/LandingPageFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
Expand Down Expand Up @@ -29,6 +31,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
return inflater.inflate(R.layout.fragment_landing_page, container, false);
}

@SuppressLint("SetJavaScriptEnabled")
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

Expand All @@ -54,6 +57,9 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {

WebView webView = view.findViewById(R.id.web_view);

// Enable JavaScript; this should be safe because we will only open wolvic.com on this view.
webView.getSettings().setJavaScriptEnabled(true);

// Links to wolvic.com will be opened in this Web view, "mailto" links will launch the email app
// and all other links will be opened in the default browser.
webView.setWebViewClient(new WebViewClient() {
Expand Down

0 comments on commit 231ef59

Please sign in to comment.