I’ve recently moved our internal APEX applications to a new environment. We have new URL for applications. During the transition, even though users are informed with new URL and asked to switch to it, we still want the old URL to redirect to new one for a period of time to ensure the smooth transition.
Oracle APEX provides the redirect capability by making the application Unavailable then perform Redirect to URL. This feature can be found under the Availability section from Shared Components > Definition.
The Unavailable (Redirect to URL) works well if we would maintain the old URL. When user enters the old URL, they will be automatically redirected to new one. The redirect happens very quickly.
In our case, since the old URL will be retired, we’d would like users to be aware of the change. Before redirecting to new URL, we’d like to display a message informing about the move and asking them to take an appropriate action.
To do this, instead of using Unavailable (Redirect to URL), I will use Unavailable (Status Shown with PL/SQL) instead.
The PL/SQL block just simply writes a Javascript to perform redirect. We will give a 3-second delay for users to read the message before the redirect takes place.
[source language=”html”]
BEGIN
htp.p (‘<html>’);
htp.p (‘<head>’);
htp.p (‘<script type="text/javascript">’);
htp.p (‘function delayed_redirect() {‘);
htp.p (‘ window.location = "http://newURL.company.com"’);
htp.p (‘}’);
htp.p (‘</script>’);
htp.p (‘</head>’);
htp.p (‘<body onLoad="setTimeout(”delayed_redirect()”, 3000)">’);
htp.p (‘<h1>The application has moved.</h1>’);
htp.p (‘<h2>The redirect will NOT work after 3/1/2011. Please bookmark the new URL.</h2>’);
htp.p (‘</body>’);
htp.p (‘</html>’);
END;
[/source]
Here is what will be displayed for about 3 seconds before going to the new site.
Pingback: OraExplorer » The Developer Toolbar in APEX Application Disappeared
You’ve imeprssed us all with that posting!
No need for Javascript, a simple meta command in the section will do:
Frank,
Yes thanks. That will do it as well.
[source language=”html”]
<meta HTTP-EQUIV="refresh" CONTENT="3;URL=http://new.company.com">
[/source]