We have a website that is rendering well on all browsers and devices, except only the first time you open it in Safari mobile ( or Safari Mac on narrow screens ).
Website: http://sheriff.org/
Reproduce on iPhone Safari:
- Open the website in private mode
- Refresh the page
Reproduce on Safari for Mac:
- Open Safari in private mode
- Switch User Agent to iOS - iPhone ( Develop > User Agent > Safari -- iOS -- iPhone )
- Resize the browser to have an approximate of a mobile device width
- Open the website
- Refresh the page
Expected: Page should render the same first and second time
Actual: For the first time in private mode, only a green box is visible The second time, page renders completely
Findings: I tried to compare both pages (when it renders correctly, and when the render is broken), to see if there are any difference, to find out that in both cases, the page has the exact same HTML & CSS.
If you inspect any of the elements that are not shown on the first attempt ( which supposed to render correctly after page refresh), you won't find any style that is affecting the element's visibility (like opacity
, display
, visibility
, position
, ...etc)
UPDATE:
It seems that there's an error in Safari Console Unhandled Promise Rejection: [object DOMError]
that might be causing this issue,
I have done a research and found out that it can be caused by auto-playing video on the page ( the page does have a video, but the video plays even if this error is thrown ), so I believe there should be another reason why this error is thrown
Any advice on why we see such behavior on Safari is highly appreciated.