Issue with openning PDF in iOS 11.3 Using PWA - ios

I've used Vuejs and Framework7 in my PWA. I want to open a remote PDF file in my PWA and also it's important to me that users be able to back to my PWA after opening PDF. I did this using :
window.open(pdf_url, "_blank");
And it works fine for iOS > 12 and after opening pdf file there is an "OK" button for closing pdf.
But for example in iOS 11.3 there is no button and user has to use home button to close PWA.
I tried to solve problem using iframe but I can show only first page of the pdf.
Is there any way to fix this issue?

You can resolve this issue by doing some tricks (for any device without back button):
if you use iframe, you can set height manualy with overflow scroll, and I think this will resolve issue (dependence of style or lib dependency, so that may be not work).
you can add back button to your navbar, or Toolbar to let user click on it to back to previous page. (I prefer this solution).
you can render pdf in popup nested of normal html page, and then you can customize popup component by handling back button, or handling close by dropback overlay.
I use second and third point in real project and its work fine...
This is sample close button code used in popup:
'<p>'+ i18nextHelper.i18next.t('Exit From PDF') +'</p>'
Note: You can also customize height page for pdf page only, and add normal button bellow it, or by add absolute positioning button above PDF, but I think if you use second or third point will be best.
Good luck.

Related

How to disable URL drag in a Capacitor application for iOS?

I have an iOS app written using Capacitor.
I have buttons which are links to different part of the application.
If I do a long press over some button then drag it the iOS shows a popup block exposing the internal link, something like "capacitor://...."
Is there any way to disable this behaviour?
I can change every link and replace href with onclick method but I wonder if there is an option somewhere in Xcode to do it for all links.

iOS PWA standalone: how to force opening in a new window

I have a PWA saved on the home screen, this opens up standardly without search bar nor the bottom buttons (share, tabs, etc..).
So every link gets opened inside the PWA, and that is expected.
I have a problem when showing pdfs as they normally open in Safari with the "share" button and all the bottom bar, but in the PWA they open up without bottom bar and without any share button.
So my idea is to open the PDF link (http://www.mywebsite.com/download/pdf/12345) in a new safari window,.
I tried putting target="_blank" on the PDF link but this did not solve the problem.
I also tried forcing the iOS behavior by opening the app in safari with safari://http://www.mywebsite.com/download/pdf/12345 but with no luck.
How do I open a New Safari window to a link?
OK, the ONLY working solution is to tell iOS you are going onto another domain.
PWA stays in your app frame ONLY if you stay in the same domain.
To open a link within your domain in an EXTERNAL window (or inside the PWA but with Safari standard controls) you have to send it to an external/different domain.
So the PWA is on https://www.mywebsite.com/ and you want to open a PDF with all Safari control buttons, you just create a SUB domain and point the link to it, like https://media.mywebsite.com/download/pdf/12345 at this point the PWA thinks you are on a different domain and does the correct rendering! 🎉
You can try to use window.open(url).
But, remember to put it in an element with onclick event attribute.
For example,
<button class='btn' onclick='window.open("https://www.google.com", "_blank");'>Open Google search</button>
Reference: window.open(url, '_blank'); not working on iMac/Safari
EDIT
You can set a scope in manifest.json to customize where to open an external link.
You can refer https://developers.google.com/web/fundamentals/web-app-manifest on the property scope.

Different behaviour in WKWebview and Safari regarding CSS

There seem te be some subtle differences in the Implementation or configuration between WBWebView and Safari (and SFSafariViewController) that renders a part of the Website I want to display unusable.
Here is what I am trying to do:
Basically all that is needed is an "App" that just opens a specific website in fullscreen mode, so no chrome, URLs or additional navigaton buttons are present. The Website works fine on Safari on iOS (and every other (modern) browser on desktop or mobile) but the menu does not when embedded in the App.
All I did was creating a new single view Application in Xcode, drop in a WKWebView and have it load the URL. The part of the page not working is this menu component that is used throughout the site: http://tympanus.net/codrops/2013/04/19/responsive-multi-level-menu/ So basically the user has no way to navigate. While debugging the website it seems like when I push the menu button the menu does not expand like it should because the changed css classes dont get picked up correctly. If I manually toggle the css classes on the menu-element it gets displayed correctly. It makes me wonder if there are some additonal constraints related to WKWebView?
Can anyone tell me if there are any settings or configurations I can alter that allow the website in WKWebView to behave exactly the same as it would under Safari?
As far as I understand SFSafariViewController I always get the browser toolbar and navigational elements which I dont want to have in the app, so that is not an option- or is there a way to get rid of that?
Any help or pointers would be greatly appreciated :)

Pdf / Docx preview in a Phonegap app on iOS

I need to open Pdf / Docx documents for preview from a Phonegap app.
On Android it's possible to open files in extenal apps using WebIntent plugin.
Now what about iOS? It seems possible to do this entirely with the build-in browser (which surprisingly does render docx) by creating a html page with a header and a back button in the top and an iframe taking up the rest of the screen.
It would be great if the user could zoom and drag the document while the header would remain stationary, but I couldn't get to zoom working at all inside the iframe.
Any suggestions?
I ended up using InAppBrowser Plugin with enableViewportScale=yes. It displays a toolbar with a back button with custom caption. It would be better if I can add my own toolbar, so the navigation is consistent in the whole app, but this is good enough.

Navigating to XAML page from WebView Windows Store application

I am developing an application, where I need to open a full-screen WebView over my existing XAML page.
Now I've added a AppBar over this WebView. The requirement is that, appBar button click should navigate me to different application Page.
e.g. WebView is opened on MainPage.xaml and on clicking the AppBar button added on this webView I have to navigate to SeconsPage.XAML
I am not able to do this now and seeing an exception thrown by COntrol_webview,exe
Can I do such navigation? If Yes, pleas help me to find out what I am I missing?
Thanks in advance!!
go for a native app - it saves you a lot of trouble. Filip Skakun already described the first crazy thing about the webview (with the webviewbrush).
if not, you can use the script notification to communicate back and forth between your webapp and your store app. here's a good link: http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx

Resources