iOS Safari calculated value does not match accepted css rule - ios

Using css !important rules to override inline styling for Google DFP injected iframes. it's been working fine for the last couple years, but since a recent iOS update, mobile safari is failing to calculate the proper width of the iframes. The iframes are set to size to 100% of the parent block (both width and height). The parent is sized correctly and the calculated value for the parent is correct. Safari's inspector shows that my width: 100% !important rule is being accepted/applied, but the calculated value for the iframe is completely different. Using responsive design mode on my desktop to preview the page shows everything working perfectly (huh?!).
I read another similar question that was answered by applying transition: none, but that's not working in my case.
I'm out of ideas and really don't want to resort to a javascript solution. Any wisdom?

Related

Iframe automatically goes full screen using Ionic 3.9.2 on iOS

Iframe automatically goes full screen using Ionic 3.9.2 on iOS.
I've tried removing all the fullscreen tags. I notice that it is not happening anywhere else. Only happens on iOS. On other devices, I have to manually make it full screen.
Why does Iframe automatically go full screen on iOS?
<iframe src="https://d1mlukbqb3dh9w.cloudfront.net/PortraitCourse/Module01/Module01Section1/story.html" height="655" width="100%"></iframe>
A while ago I would have been able to provide you with a spot-on answer. Unfortunately I no longer have access to the resources I would need to do so... meaning my answer won't be a complete solution.
IFRAME, on iOS, works slightly differently than on Android. Getting an IFRAME to take only the height you want is not simply a matter of setting the HEIGHT property on the tag as the rendering engine works differently. You'll have to play around with CSS both in the container of the tag and in the contents of the body itself.
Try proceeding as follows:
prepare a mock target page that doesn't take all the height, make
its background red and see how much space it takes
make the mock page longer than the height of the screen by adding lots of text and images to it and observe the change
wrap the IFRAME in a DIV and set the style=height: xxx of the div, as well as its overflow.
wrap the contents of the mock page in a div, setting its height, overflow, position and display style
properties to control its appearance.
repeat step (4) with both the HTML and BODY tags of the mock page.
Playing with these in real-time using Safari to alter their values will prove most useful. It was to me at least, when I had the problem over an year ago.

Replacing an iframe with a Webview in an iOS Cordova Project

I am currently developing a hybrid app in iOS that loads a website and has some other features (contacts, sharing, notifications...) using cordova plugins. I do have access to the content of the site that is being displayed by the iframe.
The normal way this is done is to load the website in an iframe. I have already done this in android and it works very well. In iOS however:
Safari messes up the size of the frame. I fixed this by setting the min-width css style to 100% for the frame.
Scrolling on the iframe is always set to "no" even if you specify "yes. I "fixed" this (so I thought) by using the only solution I could find which is to wrap the iframe in a div and scroll the div. This made the header (position:fixed) scroll with the page when it should be fixed to the top of the page and broke other things on the page that rely on scroll position to trigger an action. I also tried modifying the body of the content to contain css styles mentioned here but this didn't work either. I was back to square one.
I have spent a total of a week researching how to fix this with no avail. Recently I have discovered that loading my website in iOS's UIWebView or WKWebView works well to display the site exactly how I would expect.
That brings me to two possible solutions (and my question):
Maybe I missed something with the css style on the content of the site. I read that it is possible to get scrolling to work this way but I am sceptical because safari does not allow scrolling on an iframe.
(The likely solution but the one I cannot figure out) Make my cordova app use a one of iOS's webviews. This is what I am having problems with. I cannot figure out how to do this. Is a webview an iframe? How do I use one of these webviews in my app? What does the index.html (cordova specific file) look like when I use a webview instead of an iframe (because currently this is where my iframe is).
I solved this. Since I have access to the contents of the page, I added:
position:absolute
top: 0
right:0
bottom:0
left: 0
overflow-y: auto
overflow-x: hidden
-webkit-overflow-scrolling: touch
To the scrolling body of the page. This fixed my problem

iPhone renders HTML form different than desktop browsers

I am doing a very simple website, it's a private admin panel, it's also responsive and built around HTML5.
The login page has the standard Username and Password form fields that I have styled to appear just the way I want. I have tested this page in all 5 of the major browsers on my Windows 7 Ultimate PC (even though Safari for Windows is no more I still tested with the older version I have) and the page looks fine.
So then I grab my iPhone 4S and check the page...and the two input fields and their labels are not where I want them, rather it appears that it's just the Password label and input field. It's off in either rotation of the phone.
I have been scouring the internet for hours and am out of ideas how to reword my search query to get something of use. I have had no luck, so I copied the relevant bits of the site and made a sample website that can be found HERE.
If you resize the browser window, the inputs and labels stay where I want them. Only when viewed on the iPhone do they move from where I want them.
UPDATE
The page on which I'm having the problem has a center div that is only 300px wide, due to the fact there is so little on this page and thus no real need for the responsive action. The pages within the site will need responsive treatment, however. I mentioned responsive at the beginning of this post to be thorough. If I remove the viewport meta tag, the form fields are still out of whack, so there has to be something buggy with the iPhone version of Safari, right?
Any, and I mean ANY help will be supremely appreciated. I'm stonewalled.
Thanks!
You need media tags http://stephen.io/mediaqueries/ to resize the page for different screen sizes.
SOLVED
Well...after some experimenting, I found out that the float: left; I was using on the ``labels for Username and Password was the culprit. I changed float: left; to display: inline-block; and now the iPhone screen matches the desktop browser screen layout. Ye Gods, what a bit of headbanging. I hope this helps someone else!

VideoJS: Videosize on an iPad

I am using VideoJS to show a video. It works great in all browsers on each and every system. Exception is the iPad (iOS 5 and iOS 6, both tested on Safari and Chrome). The video resizes to about 300px width.
When i delete videoJS from the page, the video is shown correctly. But i need videoJS for skinning purposes and because it makes HTML5 video work in jQuery sliders.
I tried several things:
Manually entering width and height in video.js or JS.
Adding CSS (including !important) to the videotag and even all tags (param) below.
Tried some vague techniques i found on stackoverflow. Like -webkit-transform-style: preserve-3d; in the video-tag.
Tried to play with wmode.
Nothing seems to work. Does anyone have an idea?
First, if you haven't yet, you may want to upgrade to v4.0, released at the beginning of May (2013).
With 4.0, you can see a few examples of setting the width height, that are at least working for me on my iPad:
Width/Height 100%: http://jsbin.com/uyelud/1/edit
Width 200px/900px (weird dimension for example) http://jsbin.com/ojajuc/2/edit
To walk you through the vjs code...
The width height settings are grabbed from the tag here:
https://github.com/videojs/video.js/blob/v4.0.3/src/js/player.js#L112
Removed from the video tag (because it's wrapped by a container div and made to fill the container)
https://github.com/videojs/video.js/blob/v4.0.3/src/js/player.js#L144
Applied to the container div
https://github.com/videojs/video.js/blob/v4.0.3/src/js/player.js#L180
And then handled by the UI component code
https://github.com/videojs/video.js/blob/v4.0.3/src/js/component.js#L647
If you have different results on your page, you may want to set up a reduced test case to help narrow it down.

fitExactly not working in r-436

I just recently upgraded to 436 from 419, and have found that fitExactly will no longer have any effect.
You can see an example here:
(With 419)
(With 436)
The javascript config is in the page head.
I checked the versions in between, and the latest it works with is 419.
I could adjust the width in the Javascript configuration, but then there would be a gap left on the side of the dropcap I'm using it on, and the fact that I'm integrating it with a Wordpress theme that automatically applies sifr (other than the one in the example), meaning that each can't be adjusted by changing the width or font size.
I would much prefer to use 436, especially due to there being less page shifting, so, is there a remedy?
Thanks for your time.
If you compare the width and height of the Flash movie on both pages, you'll see that it's the same. In other words, it looks like fitExactly works fine. I wouldn't know though why Flash is clipping the rendered text.
Just to test, could you open the r436 JavaScript file, search for '419' and replace by '436', and then use the r419 Flash movie? Perhaps that provides further clues.

Resources