I have a WKWebView that navigates to facebook, instagram. Is there any way to detect whether a photo was pressed within the webView and to download the picture and present it in a modal view controller?
You need to add a user script to the webview that handles long press on images. User scripts are JavaScript code that runs at the time of your choosing. Using these scripts, you can, using a specific Apple API, pass data to your native code and do what you want.
Related
I am building an application, and when I load a website in webview using Swift 3, the screen will appear like this, now I want to detect when user clicks on the email text field, and add a button to the navigation controller.
I don't know how to do it, does anyone have any idea?
The main use of webview is near like an iframe in web.
I mean that webview is just a displaying of internet content. By this way, you cannot detect any action like user clicks on email textfield.
According to me and currently, there is no possibility to do that because it is not the goal of a webview.
We use sharer.php in a UIWebview in our app, since it enables very easy sharing with customized title and text and thumbnail without having to go through the process of setting up (and maintaining!) a facebook application (and we'd like it to stay that way).
Only problem is, that we'd like to programmatically close the UIWebview once the user clicks the share button.
is there a way to get notified in the iOS app about the user clicking the share button?
I have disable scroll in my app, so there is only scroll from facebook - it looks cute and I like it, but if came to my app directly on site, there is also no scroll bar. I tried to detect if user load page with url http://mysite.com or http://apps.facebook.com/myapps, in both ways I get the same direct address link, so I cant detect if user view my app via facebook and I need to hide scrollbar or view it on site and I need to show scrollbar. So is there a way to detect how user view my app?
What server side language are you using? If you are inside the facebook iframe, your page will be requested with a post variable set called signed_request. You can check if that has been set in your code, if it has you know you are inside the facebook iframe, if it's not then you are on your site. From here you could either conditionally change your css to allow the content to overflow properly and get scrollbars, or redirect them into the facebook app.
I have loaded a twitter url (http://mobile.twitter.com) in a webview. I have webview navigation button (back and next),which is to be disabled in the beginning. The back button gets enabled when I load a twitter feed. I did not navigate in the webview at all. When I click the back button and check it goes to a plain white screen.
To check this, I opened the Twitter URL in the Safari of the iPhone app. Even in Safari the back button gets enabled. Is this a bug? Is there any way to solve it?
The request is probably being redirected, you can check it by placing a breakpoint in the webView:shouldStartLoadWithRequest:navigationType: method of your UIWebViewDelegate.
I need to find out how to make the menu that appears in mobile safari on the iphone/touch when you tap & hold an element appear on a single tap without having to hold. how would i do this? preferably i would use webkit & no js.
UIWebView does not does not call any methods until a link is actually activated, and it does not expose any information about its subviews. There is no way to do with current SDK, you should file a bug with Apple if you need this functionality.