How are you? - Categorizr for APEX part 2: the Plug-in

Follow-up on my article: "Who are you?" – client device Categorizr for APEX

About a year ago I wrote an article on how to determine by what kind of device your APEX application is accessed: desktop, tablet or smartphone. The solution is based on a package interpreting the HTTP_USER_AGENT environment string.

This package (categorizr) in combination with APEX offers a few functions regarding the client device type (isDesktop, isTablet, isMobile, …) that can be used in conditions or anywhere else in your PL/SQL code. Now I wrote a complimentary plug-in to determine some viewport properties: ViewportHeight, ViewportWidth and Orientation and put these values into page items in session state, updating the values (in session state) each time the browser resizes or changes orientation. Additionally, I added a an event to trigger an (advanced) dynamic action: Categorizer Resize Event.

In fact, both components, the package and the plug-in, can be installed and used separate. But when installed together, the categorizr package offers a two new functions:


and three global package variables:

  • g_viewportWidth
  • g_viewportHeight
  • g_viewportOrientation


Just install the plug-in by importing the file categorizr-plugin.sql.

Install the package by running the categorizr-package.sql in the database schema associated with your application.


This region plug-in is ideally used in page 0/global page but can be used in just one or more designated pages, as long as you do not combine both approaches.

Create a new region of type plug-in and choose “Categorizr”. Make sure you use “no template” for this region, or an empty region will be displayed on your page(s).


The plug-in has three attributes to specify the names of the (hidden) page items to create for holding the viewport width, height en orientation. Just keep the default, which prefixes the items with the number of the current page (using the placeholder #PAGE_ID#).


Once having this region on your page 0, you can access the page items (i.e. P0_VIEWPORTWIDTH, …) in your SQL and PL/SQL or use the JavaScript variables viewportWidth, viewportHeight, viewportOrientation.

You can download both, the package and the plug-in here:





Popular posts from this blog

Dynamic Date Range in APEX Datepicker - no Plugin required

Remember Me - APEX Autologin

APEX on the Autonomous Database ATP & ADW Cloud Service