简体   繁体   中英

Using iphone UIWebKit to create a web browser, problems with getting url

So I am creating a web browser for iPhone for my class and I am having an issue where whenever I submit a form-like thing from a website, it doesn't update my address bar text (which is a UITextfield). As an example, if I go to google.com on my browser and so a search for something in the search field and hit submit, it loads a new page without changing my address bar (it's still on google.com). I have it to change for links, but I don't see how to make it so it works for forms like this. I added a NSLog in my webViewDidFinishLoading function and it doesn't say the page is loading, so I'm not sure how to detect when it changes this way. Does anyone have any ideas why it's not working?

Intercept it in this method instead:

- (BOOL)webView:(UIWebView *)webView
        shouldStartLoadWithRequest:(NSURLRequest *)request
        navigationType:(UIWebViewNavigationType)navigationType;

The navigationType can be UIWebViewNavigationTypeLinkClicked , UIWebViewNavigationTypeFormSubmitted or others. And [request URL] will be an NSURL object with the page URL about to be loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM