I use uiwebview on my ios application.
I have textbox above it and it navigates the uiwebview.
I enter m.youtube.com and the webview perfectly loads it. I made a search on the youtube.com and the results is loaded perfectly. When I click any of the video I go to the video page, and I want to have that url link of the page will appear with video to watch.
m.youtube.com/watch?v=sa+2DFdfd .
. but how ?
search notes:
When I try this on my iphone 5 using safari I see the navigation bar changes perfectly according to which page I am in. in this example I see; m.youtube.com/watch?v=34124S on safari but I can not cacth it on uiwebview.... I can not get the latest loaded web page link.
ShouldLoadStart does only work only for the first time page loaded. Then when you click on the page; if the link is type of <a href='/someLink' />
link the ShouldLoadStart catches the link but if it is a made of javascript type of link , the clicked link is not caught by delegates. Please help to catch m.youtube.com/watch?v=34124S like safari does on youtube pages.
I had the same issue. If it is the case you can use WKWebView.
For UIWebView the only solution I found is to get current URL via javascript:
The next issue is that shouldStartLoadWithRequest is not triggered. To solve it you can override requests with NSURLProtocol (btw it's not possible with WKWebView). Or just check current URL every second by timer :)
implement this in your webview delegate class
If you want to store the url this will do:
or
Try above two in
Also this can be done:
I got the link by using central notification. when the video appears full view, I catch that event and I get the loaded pages inner html and get the unique link..
If you have better idea please share below!