1

I tried what is described in this post. Even though I was able to change the URL of the request, but the original URL was still loaded.

What I am trying to do is to insert an authentication string into the URL (i.e. http://user:pass@url) for those that don't already have it.

The URL I'm loading has frames, so the [[webview request] URL] inside webViewDidStartLoad:webview is always the parent URL, i.e. the url that contains the <frameset> tag. That makes it hard to check whether the modified request was actually processed.

Any suggestions welcome!

Community
  • 1
  • 1
William Niu
  • 15,798
  • 7
  • 53
  • 93

1 Answers1

0

One hacky solution I found is to use javascript:

[webview stringByEvaluatingJavaScriptFromString: 
  [NSString stringWithFormat:@"location.href='%@'", newURL]];

In my case, the site has frames, so I set frames[1].location.href instead.

William Niu
  • 15,798
  • 7
  • 53
  • 93