ios webview open link in different tab/webview - ios

I have two tabs (things that are at the bottom of the 'Clock' app) both have webviews. how can I make a link that was clicked on first tab's webview be opened (and show to user) in second tab second webview if there is a string "test" in the URL.
thnak you!

You'll need to set a delegate on your UIWebView and then handle the delegate method to be able to intercept the click and send it to the tab you want.
Here's an example: UIWebView open links in Safari

Related

Display a child URL with a parent URL in the back history of WKWebView in iOS

I want to display a new WKWebView instance, such that the page currently displayed to user is the childURL, but another URL, parentURL, is in the back history of the WKWebview, such that if the user goes back in history (through a gesture or through a button which calls WKWebView's goBack function) then parentURL will be displayed.
Imagine loading parentURL at first in the webview, then tapping a link that goes to childURL. I want this (childURL is displayed, parentURL in the back history) to be my initial state in the WKWebView.
How can I do this?
I suggest:
A WKWebView displays your childURL in the beginning.
When tapping the go back button, the WKWebView make a new request of the parentURL. The button should be a native iOS UIButton. After tapped the go-back-button, change its action to make the WKWebView not to request the parentURL again.
If the go-back-button is in the .html, try to interact with javascript.
If there is some other problems left, talk to me.
If your urls is different .htmls, I think it is simple to do what i say. Your go back is just go to a new url actually.

What is this iOS view called?

When you click on a url from a native app such as the Twitter or Facebook app, a new panel comes up to display the page. When you X out the panel, you are still in the app at the location from where you launched the url. How is this done as opposed to launching the url in an instance of Safari ?
You can use either WKWebView or SFSafariViewController
SFSafariViewController is now widely used to view websites and it looks just like Safari.app (the user can access his saved passwords/cards, and he can use reader view), the problem is that you don't have any control over it.
WKWebView is a replacement for UIWebView and you will have a better control over it but you'll have to add your own navigation and refresh buttons and title bar.
UIWebView. Here is a link to apples developer reference
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/

iOs Web view how to make static a dynamic page

I have an iOs web View App wich connect to a touch responsive website and I would like to do some tabs in the app, one for contact form, another one for "about us", something like that...
The problem is you can navigate to the main web site page from those tabs by pressing the top logo page, and I would like to invalidate that from x-code without editing the word press template. Basically I would like those tabs to be "static pages". Any one has an idea on how to do that or if it's posible to do it from x-code?
Use UIWebViewDelegate's shouldStartLoadWithRequest method to check the URL your web view is trying to load. If URL is not one of the pages you want to allow access to, return false.

UIWebView -> "Add to Reading list is not displaying"

I have a UIWebView and I open a website in it. The website contains lot of hyperlinks. I get an action sheet when I long-press it in Safari: Add to Reading list, Copy and Open are displaying. However in my UIWebView Add to Reading list is not displaying (below 6.1).
You need to add that option programmatically yourself. Also note that you cannot access Safari's Reading List programmatically.
For doing this, you would need to add an UIActionSheet to your view and display it when a link is tapped in your UIWebView.
For your reference have a look at this question: how to change UIWebView Tap events
I solved above problem. I customized the contextual menu of UIWebView,
.
Sample application for customize the contextual menu of UIWebView

disable external url links in UIWebView

I used some open resource to handle my external links in WebView, so right now every time I click the url a new view would show the page with "Done" "back" "forward" "open link in safari" something like that. But at the same time the earlier webview of my app is still loading and show the url website. How could I stop it? When the user click Done for the new page, definitely they want to go back to the earlier page.
here is the open resource class I used : https://github.com/samvermette/SVWebViewController
Thanks. wish I made myself clear. I'm new here, and also new to ios development.
Not entirely clear what you're asking but every time a link is clicked in a UIWebView, the UIWebView delegate shouldStartLoadWithRequest method gets called.
If you don't want the link to load you simply return NO from this method.
There are also properties in the UIWebView class to enable you to go back or go forward through the page history.
If that doesn't answer your question, can you try and rephrase it.

Resources