যদি আপনার অ্যাপ ওয়েব কন্টেন্ট প্রদর্শনের জন্য WebView ব্যবহার করে, তাহলে আপনি নিম্নলিখিত কারণে ক্লিক আচরণ অপ্টিমাইজ করার কথা বিবেচনা করতে চাইতে পারেন:
-  WebViewট্যাবড ব্রাউজিং সমর্থন করে না। একটি লিঙ্কে ক্লিক করা ডিফল্ট ওয়েব ব্রাউজারে বিষয়বস্তু খোলে।
-  WebViewকাস্টম ইউআরএল স্কিম সমর্থন করে না যা বিজ্ঞাপনে ফেরত দেওয়া যেতে পারে যদি ক্লিক গন্তব্য একটি পৃথক অ্যাপে হয়। উদাহরণস্বরূপ, একটি Google Play ক্লিক-থ্রু URL ব্যবহার করতে পারেmarket://।
-  Google সাইন-ইন এবং Facebook সাইন-ইন WebViewএ সমর্থিত নয়।
এই নির্দেশিকাটি ওয়েব ভিউ বিষয়বস্তু সংরক্ষণ করার সময় মোবাইল ওয়েব ভিউতে ক্লিক আচরণ অপ্টিমাইজ করার জন্য প্রস্তাবিত পদক্ষেপগুলি প্রদান করে৷
পূর্বশর্ত
- ওয়েব ভিউ গাইড সেট আপ সম্পূর্ণ করুন।
বাস্তবায়ন
 আপনার WebView উদাহরণে ক্লিক আচরণ অপ্টিমাইজ করতে এই পদক্ষেপগুলি অনুসরণ করুন:
- Override - shouldOverrideUrlLoading()- WebViewClientএ। এই পদ্ধতিটি বলা হয় যখন একটি URL বর্তমান- WebViewএ লোড হতে চলেছে।
- ক্লিক URL-এর আচরণ ওভাররাইড করবেন কিনা তা নির্ধারণ করুন। - বর্তমান ডোমেন টার্গেট ডোমেনের চেয়ে আলাদা কিনা কোড উদাহরণটি পরীক্ষা করে। এটি শুধুমাত্র একটি পদ্ধতি কারণ আপনি যে মানদণ্ড ব্যবহার করেন তা পরিবর্তিত হতে পারে। 
- একটি বাহ্যিক ব্রাউজারে, Android কাস্টম ট্যাবগুলিতে বা বিদ্যমান ওয়েব ভিউতে URL খুলবেন কিনা তা স্থির করুন৷ এই নির্দেশিকাটি দেখায় যে কীভাবে অ্যান্ড্রয়েড কাস্টম ট্যাবগুলি চালু করে সাইট থেকে দূরে সরে গিয়ে URLগুলি খুলতে হয়৷ 
কোড উদাহরণ
 প্রথমে আপনার মডিউল-স্তরের build.gradle ফাইলে androidx.browser নির্ভরতা যোগ করুন, সাধারণত app/build.gradle । এটি কাস্টম ট্যাবের জন্য প্রয়োজন:
dependencies {
  implementation 'androidx.browser:browser:1.5.0'
}
 নিম্নলিখিত কোড স্নিপেট দেখায় কিভাবে shouldOverrideUrlLoading() বাস্তবায়ন করতে হয়: 
জাভা
public class MainActivity extends AppCompatActivity {
  private WebView webView;
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // ... Register the WebView.
    webView = new WebView(this);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webView.setWebViewClient(
        new WebViewClient() {
          // 1. Implement the web view click handler.
          @Override
          public boolean shouldOverrideUrlLoading(
              WebView view,
              WebResourceRequest request) {
            // 2. Determine whether to override the behavior of the URL.
            // If the target URL has no host and no scheme, return early.
            if (request.getUrl().getHost() == null && request.getUrl().getScheme() == null) {
              return false;
            }
            // Handle custom URL schemes such as market:// by attempting to
            // launch the corresponding application in a new intent.
            if (!request.getUrl().getScheme().equals("http")
                && !request.getUrl().getScheme().equals("https")) {
              Intent intent = new Intent(Intent.ACTION_VIEW, request.getUrl());
              // If the URL cannot be opened, return early.
              try {
                MainActivity.this.startActivity(intent);
              } catch (ActivityNotFoundException exception) {
                Log.d("TAG", "Failed to load URL with scheme:" + request.getUrl().getScheme());
              }
              return true;
            }
            String currentDomain;
            // If the current URL's host cannot be found, return early.
            try {
              currentDomain = new URI(view.getUrl()).toURL().getHost();
            } catch (URISyntaxException | MalformedURLException exception) {
              // Malformed URL.
              return false;
            }
            String targetDomain = request.getUrl().getHost();
            // If the current domain equals the target domain, the
            // assumption is the user is not navigating away from
            // the site. Reload the URL within the existing web view.
            if (currentDomain.equals(targetDomain)) {
              return false;
            }
            // 3. User is navigating away from the site, open the URL in
            // Custom Tabs to preserve the state of the web view.
            CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
            intent.launchUrl(MainActivity.this, request.getUrl());
            return true;
          }
        });
  }
}
কোটলিন
class MainActivity : AppCompatActivity() {
  private lateinit var webView: WebView
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    // ... Register the WebView.
    webView.webViewClient = object : WebViewClient() {
      // 1. Implement the web view click handler.
      override fun shouldOverrideUrlLoading(
          view: WebView?,
          request: WebResourceRequest?
      ): Boolean {
        // 2. Determine whether to override the behavior of the URL.
        // If the target URL has no host and no scheme, return early.
        if (request?.url?.host == null && request.url.scheme == null) {
          return false
        }
        val currentDomain = URI(view?.url).toURL().host
        // Handle custom URL schemes such as market:// by attempting to
        // launch the corresponding application in a new intent.
        if (!request.url.scheme.equals("http") &&
            !request.url.scheme.equals("https")) {
          val intent = Intent(Intent.ACTION_VIEW, request.url)
          // If the URL cannot be opened, return early.
          try {
            this@MainActivity.startActivity(intent)
          } catch (exception: ActivityNotFoundException) {
            Log.d("TAG", "Failed to load URL with scheme: ${request.url.scheme}")
          }
          return true
        }
        val targetDomain = request.url.host
        // If the current domain equals the target domain, the
        // assumption is the user is not navigating away from
        // the site. Reload the URL within the existing web view.
        if (currentDomain.equals(targetDomain)) {
          return false
        }
        // 3. User is navigating away from the site, open the URL in
        // Custom Tabs to preserve the state of the web view.
        val customTabsIntent = CustomTabsIntent.Builder().build()
        customTabsIntent.launchUrl(this@MainActivity, request.url)
        return true
      }
    }
  }
}
আপনার পৃষ্ঠা নেভিগেশন পরীক্ষা করুন
আপনার পৃষ্ঠা নেভিগেশন পরিবর্তন পরীক্ষা করতে, লোড
https://google.github.io/webview-ads/test/#click-behavior-tests
আপনার ওয়েব ভিউতে। আপনার অ্যাপে তারা কীভাবে আচরণ করে তা দেখতে বিভিন্ন ধরনের লিঙ্কের প্রতিটিতে ক্লিক করুন।
এখানে চেক করার জন্য কিছু জিনিস আছে:
- প্রতিটি লিঙ্ক উদ্দিষ্ট URL খোলে।
- অ্যাপে ফিরে আসার সময়, পৃষ্ঠার অবস্থা সংরক্ষিত ছিল তা যাচাই করতে পরীক্ষার পৃষ্ঠার কাউন্টার শূন্যে রিসেট করে না।