-1

I created a WebView (with JavaScript enabled) in my app to display a link programmatically. I send the url to it, and it loads. I do the same thing, instead sending it programmatically to a browser on the phone.

These look like the first picture.

The problem is the page displayed in both of these cases is different than if I copy and paste the link (generated in the app from the Log) to the same browser on the device manually, or open it on my desktop browser. These look like second picture.

A sample link is:

http://lyrics.wikia.com/index.php?title=Future:Karate+Chop+%28Remix%29&action=edit

Why could this be?

from app copy and paste url from Log into browser

Steve M
  • 9,296
  • 11
  • 49
  • 98

1 Answers1

1

Sounds like you need to override the shouldOverrideUrlLoading in your WebViewClient, which should be attached to your webview, also in the overriden method it should return false if you want your webview to handle it.

The second thing I would recommend would be to also change the UserAgent that is being attached to your WebVIew as well since you're seeing a difference in Desktop/Mobile version of the website.

You can learn more about tweaking the user agent here: Want to load desktop version in my webview using uastring

Community
  • 1
  • 1
JoxTraex
  • 13,423
  • 6
  • 32
  • 45
  • The user agent is on the right track. Changing the user agent to look like a desktop makes it load the right page, but the desktop version. But there is a mobile version of the right page, look at second pic! How to trick it? – Steve M Oct 21 '13 at 01:52