Android webView shouldOverrideUrlLoading for iframes

I have a local website controlled by JavaScript and load it into WebView. The website is actually a main page with iframe, and its content changes according to user input. There is a "next" button on the main page to run some JavaScript functions and decide which page to load in iframe (through document. GetElement (...). SRC =)

In Android 2.1, everything works well - simulation and phone. WebView is loading all pages correctly. I tested it on my 2.2 phone. Whenever I click next, the page (which should be loaded into iframe) will be loaded in the default browser

I defined an intent filter

   <intent-filter>
     <action android:name="android.intent.action.VIEW" />
     <category android:name="android.intent.category.DEFAULT" />
     <category android:name="android.intent.category.BROWSABLE" />
     <data
       android:scheme="file"
       android:host="*"
       android:pathPrefix="sdcard/Android/data/android.website/files/pages"
     />
    </intent-filter>

You want it to redirect the page request to the activity, but it doesn't work. The web address is still loaded by the browser

Shouldoverredeurlloading doesn't work well because the loaded link is one of the internal frameworks. I tried to load JavaScript code and set the URL to the SRC of iframe, but it didn't work

Strangely, this only happens on 2.2 phones. In the 2.2 simulator, it works normally

Any ideas?

resolvent:

Try to provide your own webviewclient to WebView. You should override shoulderoverrideurloading (..) and return false

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>