Closed lucca65 closed 4 years ago
@lucca65 I did some tests with creating a new tab with PDF for mobile Safari and realized that it doesn't bring much benefit.
Safari has the feature that the newly opened tab also has the Back button which leads to the page from which this tab was opened. I thought that the Back button for the new tab with PDF will bring the user to the login screen, but it brings the user to the Registration screen. And that's even more confusing.
The current variant opens PDF in the same tab where the user fills the registration info and the Back button brings the user to the login screen which is quite intuitive.
I'll close this issue for now.
For the protocol, here's the detection function I used:
const isMobileSafari = (function () {
const ua = window.navigator.userAgent
const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i)
const safari = !!ua.match(/Safari/i)
return iOS && safari &&
!ua.match(/FxiOS/i) && // Not FF
!ua.match(/CriOS/i) && // Not Chrome
!ua.match(/EdgiOS/i) // Not Edge
})()
And the PDF download/open call:
if (isMobileSafari) {
pdf.open()
} else {
pdf.download(accountName + '_cambiatus.pdf')
}
I see. Thanks for the insight and research @amiskov! 💪
Try to open in a new tab only for mobile safari