Delayed Message When URL redirect for Oracle APEX application

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.

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;

Here is what will be displayed for about 3 seconds before going to the new site.

4 Responses to Delayed Message When URL redirect for Oracle APEX application

  1. Frank van Bortel October 11, 2011 at 9:21 am #

    No need for Javascript, a simple meta command in the section will do:

    • ittichai October 11, 2011 at 10:10 am #

      Frank,

      Yes thanks. That will do it as well.

      <meta HTTP-EQUIV="refresh" CONTENT="3;URL=http://new.company.com">
      
  2. Vinny December 12, 2011 at 5:27 am #

    You’ve imeprssed us all with that posting!

Trackbacks/Pingbacks

  1. OraExplorer » The Developer Toolbar in APEX Application Disappeared - May 10, 2011

    […] Delayed Message When URL redirect for Oracle APEX application […]

Leave a Reply

Powered by WordPress. Designed by WooThemes