views:

187

answers:

2

I have a UIWebView that loads a URL through loadRequest in viewDidLoad. The user clicks a button in the RootViewController, which pushes the webview and a webpage appears. With only access to the webpage code, is there a way to redirect the user? I tried the META Refresh but that didn't have any affect.

Links won't work since none of the webview delegate methods are implemented in the webview. I'm trying to avoid releasing an update of the app for now.

+1  A: 

Use javascript:

window.location = 'http://stackoverflow.com/questions/744329/possible-to-redirect-using-only-webpage';
altCognito
+2  A: 

1) Check again the meta refresh syntax:

<head>
<meta http-equiv="refresh" content="0; URL=http://www.example.com/page123.html" />
</head>

2) You said you have access to the webpage code, how far does this go? Can you manipulate the http-header, in case of a php-page this is possible:

<?php
header("Location: http://www.example.com/page123.html"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

Example taken from http://de.php.net/header

Other server side languages should have something similar.

3) Use javascript:

window.location = 'http://www.example.com/page123.html';
I need to the meta refresh with delay. Apparently it is a UIWebView thing. Works fine in Mobile Safari and desktop. I didn't implement any of the UIWebView methods so I'm guessing that is why it doesn't work in my app.
4thSpace