I am doing cordova-ios hybrid application. Some places I need to display pdf files, so I wrote plugin to show pdf on child webview. Once pdf get loaded, I am placing child webview as an overlay to the existing webview. Everything working fine but some buttons are still visible on on the parent webview. When user tap on it, options popup is coming but it is below the child browser. I need the popover should come over the child webview itself. Any help/solution would be appreciated :) Thanks!
Related
I've got a Plugin which uses a UIKitView which contains a WKWebView on iOS and a AndroidView with WebView on Android. The Android solution is working as expected, but I've got two problems on iOS. First, some contents of the web-view, e.g. HTML content, is overlaying the AppBar and second, i can click right through a Drawer element which triggers some click events of my HTML page. I've been able to "solve" the first problem by putting the plugin view into a ClipRect.
Any ideas what causes this behaviour and how to solve it, especially the second one?
In iOS 13 Safari, when you long press on a link, you see a preview of the linked page, along with some menu items. If you tap the preview, you navigate to that page.
Now, I see how to intervene in the long-press-and-preview process. This used to be peek-and-pop, but in iOS 13 that's deprecated and we're supposed to use func webView(_:contextMenuConfigurationForElement:) and so forth. Fine, but how would I imitate what Safari does?
The problem is that as my preview provider I have to supply a view controller. So I'm going to need a different view controller with a web view showing the linked page. Okay, I can do that. But then when the user taps the preview to dismiss it, I want to respond by loading the same linked page into my real web view.
But that's the problem. That loading takes time. In Safari, by contrast, when you tap the preview, boom, there's the same page already loaded. How do they do that? How would I do the same thing? How can I load the page into a different view controller, cache it, and communicate that cached page back to my real web view?
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.
I have a native iOS app that contains a tab bar. The view controller for each tab contains a UIWebView. When the user switches between tabs, I load the HTML in the corresponding web view. The HTML is fully cached on a device. Here is how I feed the HTML to UIWebView:
[self.webView loadHTMLString:htmlString baseURL:baseUrl];
baseUrl is a file URL pointing to a directory where all assets are located.
This works great in online and offline modes, however it takes time for the UIWebView to parse and render the HTML. As a result, the user sees a brief blink of a white background when switching between tabs. I'd like to remove it, because the user is able to tell that the UI is not native (native UI renders instantly).
I was thinking about taking a screenshot of the UIWebView once it's done rendering the HTML and caching it in memory. The next time the user navigates to that web view, the app displays the screenshot while the UIWebView is rendering the HTML in the background. Finally, the app swaps the screen shot with the actual UIWebView and takes a new screenshot. This is similar to how Google Chrome app works.
Does anyone know a better solution to this problem?
Depends on how you present that web view. I'm not really sure from your description how you do it, but since you're talking about a blink of white background, I'm going to assume there is a situation where you have a web view with a loaded html and then you switch it to another html. The solution for that case would be:
create a second web view,
load the new html to this new web view,
when that web view finishes loading html (you can find out if you use UIWebViewDelegate) you can then quickly switch it with your old web view (meaning you finally add the new web view to the view hierarchy at THIS point, not when you created it).
This way you'll have an instant switch between old and new html, however user will be left waiting and it is your decision what to do with it. You could use UIActivityIndicatorView for example.
When webViewDidFinishLoad: gets called you can do any number of things, make the webview visible, remove something that you had on top of the webview etc...
I'm trying to write an HTML5 application for iOS (not the routers) that opens PDFs. Right now I'm just using <a href="some.pdf" type="application/pdf">. This exits the application and opens the PDF in Safari.
How do I get the back button to take the user back to my application, or view the PDF without Safari chrome?
I'm using Sencha Touch and would deploy with PhoneGap.
I don't know of an easy way to do this as your application is hosted in a singular UIWebView as well so displaying a PDF in it would result in the inability to display a back button or for the user to navigate back to your application.
The only was that I could envision to do this would be to write a PhoneGap plugin that would create another UIWebView set it to the PDF's content, and add it to the master UIViewController. You would then set the view to be x pixels from the top which would allow you to display a back button in a toolbar fashion. When they click back, the plugin unloads the PDF, destroys the view, and your application is still going. (You could also just create a View on top with a native back button that just hides the PDF's UIWebView when clicked).
You should create an NSURLRequest pointing to the PDF and feed it to your UIWebView:
- (void)viewDidLoad {
[super viewDidLoad];
[webView loadRequest:[NSURLRequest requestWithURL:pdfUrl]];
}
I don't know where you get your PDF from, but if you need to intercept the click on the link
you can also do that by defining your UIWebView's delegate
-webView:shouldStartLoadWithRequest:navigationType:.