Differences between Origin, Iframed, and Webview'd iOS embeds
We use slightly different embedding hacks in iOS for each of:
- Origin pages (pages on publisher's origin, or directly accessing CDN page)
- Iframe'd embeds (publisher or CDN page is embedded in an iframe)
- Webview'd embeds (publisher or CDN page embedded inside a native webview)
This had led to multiple bugs (b/65225385, b/36068204, https://github.com/ampproject/amphtml/issues/11253#issuecomment-332136756) that are very difficult to test for (who'd think to test the page in Google Search and Google Search App?) and impossible to debug (non-Googlers do not have access to debugging versions of iGSA that connects to Safari Debugger).
We really need to switch to a single embedding type (Iframe'd) that is used in all cases. This will greatly simplify testing and debugging, by creating one single consistent environment.
Definitely unfortunate. But given the ugliness of some solutions for iframes, I'd hesitate to consign other clients to be forced into the same world.
/cc @cramforce
+1 Strongly opposed to going iframes everywhere. I think that no-iframes is the more desirable, but that will take a while.
I see consistency as a better goal than cleanliness, especially if publishers keep hitting "full page is invisible" bugs in webviews.
The wrappers/styles are necessary on origin page so the pubs can built and manually test the page. The fixed position hacks are not, so they don't need to be installed.
Can you quickly explain how the webviews are different from a straight up "load cached page in web browser" page load?
Pulling from b/65225385#comment12:
The only difference between the webview's Natural viewport and a normal Natural (used in SERP embeds in Android, and all origin pages) is the
html.i-amphtml-webview > bodystyle, which adds an explicitoverflow-x: hidden; overflow-y: visible;. To be clear, I don't think we should remove this style and make this webview exactly match normal Natural. I think iOS should always use NaturalIosEmbed (in SERP, origin, and webview), and Android should always use Natural. The arguments I can think of against this change is the weird DOM hacks we put in (wrapper body element, styles). But the pros are that it would make any problems clear to the publisher when they test origin sites (what I assume is the most common way to build a page). And we can disable FixedLayer transfer in unneeded cases.
Hmm, having these extra styles (I assume because of swiping?) is, indeed, very unfortunate.
Swiping, meaning scrolling? Then yup, all the hacks are to make iframes scrollable.
Na, I mean in the webview. Swipe left, right. Could we remove those extra styles?
On Wed, Sep 27, 2017 at 8:15 AM, Justin Ridgewell [email protected] wrote:
Swiping, meaning scrolling? Then yup, all the hacks are to make iframes scrollable.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/11445#issuecomment-332555570, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFeT65PzJm5d9mhetWxuoGKUjIanaWPks5smmZ4gaJpZM4PksWn .
For feebee case #11253 (comment) , I get feedback from feebee developers: they reduce the style size from 48KB to 44KB and then AMP page gets rendered well.
If I remember right, yes, iOS (and even Android) WebViews had problems with ~scrolling~ swiping due to default overflow-x: visible. We had to add those. We can try and set overflow-x: hidden in standalone case. Would that reduce fragmentation?
@101keith Thanks for looking into this. It seems like the changes they made are live now and I'm seeing the page render correctly in AMPKit viewers (iGSA).
@dvoytenko When you say iOS (and Android) WebViews had problems with swiping, do you mean swiping left/right like Malte mentioned? Since the embedded webview case doesn't need to swipe (that's handled on the native side) I'm guessing there's something else you're referring to here?
@stephen-deg I'm pretty sure it's related to swipe left/right. I know that definitely Android has issues with horizontal swipe as by default the touches are tested against possible horizontal scrolling inside the WebView.
In my notes here, it says:
Set
body {overflow-x: hidden}for iOS WebView. This is b/c iOS WebView does NOT respecthtml {overflow-x: hidden}.
And the best I can find now, this was done due to https://github.com/ampproject/amphtml/issues/3712
PTAL
For reference, here's an example of rendering issues under iGSA on a real device. Most AMP results load fine, but there are blank pages at ~36s and ~1:21s in the video:
Screencast: https://photos.app.goo.gl/fD2qr04t6SSXdY942 OS: iOS 11.0.1 Version: Google Search App v35.0.167640935
Could anyone explain why body {overflow-x: hidden} would lead to a blank page?
Also CC @ericfs
I think @dvoytenko's history is correct. #3712 was filed because pages with horizontal scrolling caused problems for swiping between documents.
This is a high priority issue but it hasn't been updated in awhile. @cramforce Do you have any updates?
This is a high priority issue but it hasn't been updated in awhile. @cramforce Do you have any updates?
This is a high priority issue but it hasn't been updated in awhile. @cramforce Do you have any updates?
This is a high priority issue but it hasn't been updated in awhile. @cramforce Do you have any updates?
This is a high priority issue but it hasn't been updated in awhile. @cramforce Do you have any updates?