Reputation: 785
Technologies Used: Swift, ios8, xCode 6
I'm using the uiwebview to load a website into my app. The user can click around to different pages of the website.
I want the user to have the option to save the url of the page they happen to be on.
And if they go to another page within the website, to be able to save that page's url and so on and so forth.
What is the best way to accomplish this in swift?
Upvotes: 0
Views: 352
Reputation: 2782
I've used something like this before:
let webView = UIWebView()
if let urlString = webView.stringByEvaluatingJavaScriptFromString( "window.location.href" ),
let pageURL = NSURL(string: urlString) {
// Save the URL
}
Upvotes: 1