Discussion Forums  >  WebViews and HTML for Mobile

Replies: 18    Views: 135

techdesigner
Apple Fan
Profile
Posts: 77
Reg: Jun 22, 2012
Cleveland
10,870
01/28/13 09:04 AM (11 years ago)

Scale Custom URL page in Android

When I view a Custom URL page on an Android device it locks the scaling so that the web page is larger than the device window especially in portrait. On a tablet, if you turn landscape it shows most of the page. The only way to see the page is to scroll around. You can not pinch to make it larger or smaller. I do not see any settings in BT to accomplish auto scaling or manual pinching. Does anyone have experience with getting this to work. Thanks, Greg
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/28/13 09:17 AM (11 years ago)
Does the page you are linking to have the same issues if you paste the URL into the android browser?
 
techdesigner
Apple Fan
Profile
Posts: 77
Reg: Jun 22, 2012
Cleveland
10,870
like
01/28/13 10:16 AM (11 years ago)
In Google chrome the page automatically fits the width of the browser both landscape and portrait.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/28/13 10:39 AM (11 years ago)
Is there mobile metadata in the head of the html document?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/28/13 10:41 AM (11 years ago)
Can you let us take a peek at the link?
 
techdesigner
Apple Fan
Profile
Posts: 77
Reg: Jun 22, 2012
Cleveland
10,870
like
01/28/13 11:14 AM (11 years ago)
The link goes to the home page http://www.transtec.com We have some of the site set up as mobile pages but this link was to take you to the main site.
 
techdesigner
Apple Fan
Profile
Posts: 77
Reg: Jun 22, 2012
Cleveland
10,870
like
01/28/13 11:21 AM (11 years ago)
@raveyd is this what you were asking about? <meta content="width=device-width; initial-scale=1.0; maximum-scale=2.0; user-scalable=1;" name="viewport" /> We do have it in the page.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/28/13 11:56 AM (11 years ago)
Does the home page show the problem?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/28/13 11:57 AM (11 years ago)
Hi @techdesigner, yes, that's what I meant. I took a look at the link you provided, the metadata you posted above isn't in the source. What you have is a 'max device width' of 480px. 480px is more usual for landscape mode, 320px is normal for portrait. If you can change that, it might fix it, just guessing though. And you should definitely include the <meta content=....... etc
 
techdesigner
Apple Fan
Profile
Posts: 77
Reg: Jun 22, 2012
Cleveland
10,870
like
01/28/13 04:48 PM (11 years ago)
@raveyd we tried changing the meta > initial-scale=1.0 and it made the Android look better but then it looked bad on the iOS side. In order to get it look good on both we would have to recreate the site with the different metas for each OS. Not very practical:( There must be a better way to specify iOS or Android metas in a site like the IE tags that you add to site because Microsoft browsers never work.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/28/13 05:40 PM (11 years ago)
Ok, getting closer! Try this metadata in place of the metadata you used. This should be ok for Android and iOS: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes"/> <meta name="apple-mobile-web-app-capable" content="yes" />
 
techd
I hate code!
Profile
Posts: 44
Reg: Sep 17, 2012
Cleveland
440
like
01/29/13 12:06 AM (11 years ago)
@raveyd thanks, will try it when we get in.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/29/13 03:00 AM (11 years ago)
Everything @raveyd advised is good practice and definitely worth doing, but I cannot reproduce the pinch/zoom problem. I tried the page <a href="http://www.transtec.com" target="_blank" rel="nofollow">http://www.transtec.com</a> on my iPhone, it scaled and resized, also did that on my Android phone, hence the question on if the link you've given us shows the problem. You may want to apply different css according to the detected screen size to get the presentation right - if that is the case post back and let us know.
 
techdesigner
Apple Fan
Profile
Posts: 77
Reg: Jun 22, 2012
Cleveland
10,870
like
01/29/13 08:40 AM (11 years ago)
@raveyd and @AlanMac It does auto resize and allow pinching in the standard Android browser. I think it has something to do with the Custom URL plugin locking to it's own size that is about 15% too large for the device width. I try to pinch smaller to fit the screen but it will not. I can only pinch larger and scroll. I could send you the APK if you want to see it in the app.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/29/13 09:26 AM (11 years ago)
I understand better now, thanks @techdesigner. I believe @raveyd is on the right track, you could try reducing "initial-scale=1.0", to 0.75 maybe?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/29/13 12:12 PM (11 years ago)
Got it! There's a fixed width table (490px) in the footer, it won't resize to fit screen. It's wrapped in its own div so you could change 490px to 100%, which <i>should</i> fix it. *edit* There's also an image at the top of the screen - the guy with the transmission kit - it's a fixed 300px, which might cause horizontal scrolling on smaller screened devices. You could remove the height tag and make the width 100%.
 
techd
I hate code!
Profile
Posts: 44
Reg: Sep 17, 2012
Cleveland
440
like
01/29/13 08:58 PM (11 years ago)
@raveyd if I view the site in a standard browser it scales properly. That is why I thought it had to be a BT setting.
 
techdesigner
Apple Fan
Profile
Posts: 77
Reg: Jun 22, 2012
Cleveland
10,870
like
01/29/13 09:14 PM (11 years ago)
Android and iOS default browsers both scale properly and the iOS custom URL page scales hor and vert properly.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/30/13 08:26 AM (11 years ago)
The site isn't optimized for mobile. The browsers in my two Android phones are just shrinking it to fit, not actually scaling it for mobile, making the content too small and unreadable without zooming, which results in horizontal scrolling anyway.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.