My problem is the following. I have an application that asks the user to insert a Url on Wikipedia. For example the user inserts :
URLInserted = "http://en.wikipedia.org/wiki/USA".
Inserting this URL opens the page
TrueURl = "http://en.wikipedia.org/wiki/United_States"
that is the real URL of the Unites States page on Wikipedia. Once the page is loaded I save the current URL into a variable. When I print the string contained in the variable the URL that is printed is the URLInserted
and NOT TrueURL
. I would like that the URL that I save into my variable is the TrueURL
of the United States page and not the URLInserted
by the user. How can I solve this issue? This is the function that I use to get the URL :
currentUrl = String(describing: WebView.request?.mainDocumentURL)