2

What's the Problem:

Unfortunately I must use an Iframe in a web solution (tenant scoped SharePoint hosted App with App Parts). The iframe needs around 50% of the website's space and the space for it in the host will be programmatically blown up in size so that there will be no scrolling bars shown. It works good on every browser except Safari. In Safari the touch event seems to be caught by the iframe window and will not be forwarded to the host window. Imagine this on the iPad: in over 50% of the page the user can't scroll down the page.

Hardware I used for testing:

  • Windows 8.1 (touch enabled screen) with latest version of Safari (5.1.7)
  • iPad with iOS version 8.4.1.

What I researched/tried so far:

  1. This has nothing to do with everything that can be solved by "-webkit-overflow-scrolling: touch;" and similar approaches. From what I understood in my research, this will make the iframe scrollable but I need to make the host window scrollable when moving the finger in the iframe area. In other Browsers the iframe for example scrolls down until the end and then starts scrolling the host window

  2. In some post one suggested to overlay the iframe with a div (z-index: 2) and then forward the click events from this overlaying div to the Iframe window ( I do have control on this Iframe window, so I can catch events in there). The overlaying div fixed the scrolling behaviour on my testing page but not in my target application, so it's not a reliable solution. Besides that: I managed the click event to be triggered (with same approach as in 3.) but could not manage to make it click links in my iframe-page (what I need... because this is the reason why I want the clicks to be forwarded.)

  3. Another approach was to forward the touch events from the Iframe page to the host page. I did this via postMessages, JSON-stringified event parameters and a javascript library called "jquery.simulate.js" that is used to simulate touch events. I did not manage to trigger the touchmove event correctly on the parent window (and besides that I doubt that this is really good concerning user experience and performance)

  4. I also thought about getting the simple html from the Iframe and add it to the host page programmatically. Unfortunately SharePoint hosted Apps are hosted on other subdomains, so due to the cross-browser restrictions I think is not worthid to follow.

  5. Another approach was pointer-action: None; - This also breaks the link functionality and unfortunately worked only on the desktop

  6. Setting scrolling="no" (or "yes") did not have any effect nowhere (maybe because it's gone in HTML5)

So here I am stuck... and it seems that no one else in this world has the same problem as I cannot find any really working idea anywhere. But I tested around 20 different websites with iframe - and I tested with the Desktop touch and the iPad.... and I have the same problem. I could not find a single Safari-Touch-working iframe throughout all suggestions and possible solutions.

How to reproduce: A simple

<iframe src="http://www.w3schools.com"></iframe>

embedded on any html page with long content, Safari and a touch device (similar to the ones I used for testing) should be enough to reproduce.

What I want to know:

  • Does anyone have the same problem?
  • Could you put me into the right direction? I am actually unsure which of the above mentioned approaches I should continue to go on with
  • Do you have a completely new idea that I could follow?
  • Did you test this on any other device and know it's working? (I am thinking maybe downgrading could be a solution)

Edit: (Solution Nr. 2) The overlaying div makes the page indeed also scrollable in Safari, but I could not find the correct way how to forward the click event to the child successfully (meaning: which of the event parameters are necessary to be forwarded to trigger the click event in the child window?)

Edit: Searching again and found out that you cannot create events like clicking programmatically due to security reasons. Makes sense as this will be a big security issue if you could force the user to click on your ads for example. How can I click on specific (x,y) coordinates on a web page?

Community
  • 1
  • 1
Melanie Pl
  • 21
  • 5
  • I have the same issue! It seems to be related to SharePoint. When I manually remove the init.js file, it seems to work fine, but then of course SharePoint is broken. Any traction on this? – dprothero Dec 08 '15 at 21:42
  • Hey there, it's been a while. We changed our solution to local JavaScript and did not use the AppPart approach in the end. From what I heard so far, the new webpart model will be all client side js code anyway. Something good to know: You are able to read items from lists in the add-in-web, when you call the api without the guid in the add-in-web-URL (yes I know...that sounds strange but it works). That way we are hosting the configuration values in the add-in web and load them via local js-code in the host web. – Melanie Pl May 30 '16 at 11:05
  • I have this problem! I have not found a solution anywhere. – d13 Mar 29 '17 at 15:59

0 Answers0