0
我有webView併發送我的cookie到我的網站使用相同的會話(網上商店)。如何獲取在UIWebView中加載的頁面的http://地址?
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetMaxX(self.view.frame), CGRectGetMaxY(self.view.frame))];
[webView setDelegate:self];
[self.view addSubview:webView];
NSString *sessionId = [[OCRESTAPIClient sharedClient] sessionId];
NSString *value = [@"xid=" stringByAppendingString:sessionId];
NSURL *url = [NSURL URLWithString:@"http://MySite.ru/cart"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:value forHTTPHeaderField:@"Cookie"];
[webView loadRequest:request];
用戶可以在我的網站上行走,我必須知道他在哪裏。我怎樣才能獲得在webView中加載頁面的網址?
[獲取UIWebview的當前URL]的可能重複(http://stackoverflow.com/questions/2491410/get-current-url-of-uiwebview) –