disable external url links in UIWebView - ios

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.

Related

Website wrapped in iOS App - Catching hyperlink click events

I have a iOS app that wraps a website. When the user clicks a link in the wrapped website, I want to trap the event in my app and be able to get information about the link that was clicked. Is this something that can be done in Swift?
I'm relatively new to iOS app development and I'm working on an app that has been around for a while.
The short answer is "Yes". There are a couple of views that you can use in iOS to display web content. One such view is WKWebView.
If you look at the documentation at that link, close to the bottom of the page you will find a header for "Managing Navigation Through your Web Content".
What you do is create a WKNavigationDelegate that you attach to your WKWebView. That delegate is notified when the user wants to navigate through the web content (for example, when they click on a link) and lets your application code participate in the navigation process. It can allow navigation, deny navigation, find out when it starts and stop, things of that nature.

How to show popup ads on click in webview using sketchware

Can someone help me and tell me how to enable popup ads window on click in webview using sketchware
it's a bit tricky to make the WebView interact with the app in sketchware but...you can improvise to work around that...I'm pretty sure there's tons of ways to do it..try this(i can't send an image cause of rep):
add webview widget
Go to event of webview
Click "onPageStarted"
Put "If" block
in the if block You'll compare the url variable with the url when the button is clicked and if they're equal, then load your ad
and if you don't get it...let me know I'll share a project that can do the same thing

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.

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.

How to un-hide image if UIWebView URL is not www.example.com

I am making a app which opens local files and navigates through them. Is there code I can use which will scan the URL and check if it is a certain URL and if it isn't it will run a command such as;
[homebutton setHidden:NO];
The point of this is to make a 'back/home' button appear if the user navigates to another site rather than the build in pages.
I would really appreciate some help, thank you! :-)
Use the UIWebViewDelegate methods to monitor the URLs that are being loaded. That way you can easily hide or show the button as appropriate for the current URL.

Resources