1. Overview

This document talks about prevent opening Oracle APEX application in multiple tabs with the same session state.

2. Technologies and Tools Used

The following technologies have been used to achieve this functionality,

  • JavaScript

3. Use Case

The reason to avoid opening multiple tabs with the same session state is that there is a risk of incorrectly updating session states. As a result, incorrect data gets updated to the database.

4. Architecture

Here, we are just going to add simple JavaScript code in the global page of the application which will disable showing the Open New tab link on the right click of the mouse across the application.

Follow the steps to set the session state value using JS,

Step 1: Go to the global page of the application.

Step 2: Then create a dynamic action as below,

        eg:      

              Name – Prevent opening application in multiple tabs

              Event – Page Load                          

              Action – Execute JavaScript Code

              Code –

                           $(“body”).on(“click”, “a[datahref]”, function() {

                                   var href = $(this).attr(“datahref”);

                                   if (href) {

                                         location.href = href;

                                   }

                            });

 

                          $(document).mousedown(function(e) {

                                 if (e.button == 2) {

                                      $(‘a[href]’).each(function() {

                                            var $t = $(this);

                                            $t.attr({

                                               datahref: $t.attr(‘href’)

                                            })

                                         .removeAttr(‘href’);

                                   });

                             }

                            return true;

                       });

Step 3: Finally, save the changes and run the application.

Note: Please refer to the blog to detect the multiple tabs link

Recent Posts

Start typing and press Enter to search