ScreenOrientation Meta Tag

PocketBrowser 3.x API

The ScreenOrientation Meta Tag is used to control the screen orientation and layout, and can register to receive an event when it changes. A new orientation will persist if PocketBrowser is closed or the device is warm-booted.

ScreenOrientation (META Tag) Syntax
<META HTTP-Equiv="ScreenOrientation" content="[orientation>
<META HTTP-Equiv="ScreenOrientation" content="ScreenOrientationEvent:url('[jsFunction | url]')">


Items listed in this section indicate methods or, in some cases, indicate parameters which will be retrieved.

Name Description
Default Value
Normal Sets the screen orientation to portrait Device Dependant
RightHanded Sets the screen orientation to righthanded (landscape). Note the webpage will not reformat in line with the new screen size automatically. Device Dependant
LeftHanded Sets the screen orientation to lefthanded (landscape). Note the webpage will not reformat in line with the new screen size automatically. Device Dependant
UpsideDown Sets the screen orientation to upside down, useful if presenting the device to a customer to obtain a signature. Device Dependant
Copy methods template to clipboard: Copy META Tag template to clipboard META Tags Copy Javascript template to clipboard Javascript

Modules return information back to their web pages via retrieval tags, for example the scanner has a retrieval tag called 'DecodeEvent' which is called whenever it decodes a barcode. To register to receive a retrieval tag call the module as follows:

<META HTTP-Equiv="[Module]" content="[RetrievalTag]:url('[URI]')">
So to register to retrieve the Scanner's DecodeEvent the following syntax would be used:
<META HTTP-Equiv="Scanner" content="DecodeEvent:url('Javascript:doScan('%6', '%s', %3, '%2');')">

Retrieval tags return information by replacing the text in place holders, defined as '%s' or '%<number>'. Each place holder represents 1 return value with '%s' being populated sequentially or '%<number>' providing direct acces to the desired value.

If the content for the Scanner's DecodeEvent is:

"url('Javascript:doScan('%6', '%s', %3, '%2');')"

The function would be called as follows:
"Javascript:doScan('Decode', '5449000053879', 0x35, 'SCN:EAN13');"


ScreenOrientationEvent
The screen orientation event is sent when the current PocketBrowser application changes the orientation of the screen. For devices with an inbuilt accelerometer this event will also be sent when the user physically rotates the device to a new orientation.

ID Name Description
1 Orientation Either 'Normal', 'RightHanded', 'LeftHanded' or 'UpsideDown'
Copy this return value template to clipboard: Copy META Tag template to clipboard META Tags Copy Javascript template to clipboard Javascript



The following example orientates the screen to righthanded in landscape mode:

<META HTTP-Equiv="ScreenOrientation" Content="RightHanded">
Copy example to clipboard Copy example to clipboard
Effect on Command Areas and Contol Buttons
When the screen orientation changes, either using the ScreenOrientation tag or by rotating a device with hardware support, the command areas will automatically move and resize to fit the new layout. However the buttons themselves are not moved and in some cases this may result in them being off the screen or not in the expected position. If so they must be moved manually by detecting the ScreenOrientationEvent.


Supported Platforms Windows Mobile
Persistence ScreenOrientationEvent is page specific. Setting the screen orientation will persist across pages and will also be remembered if PocketBrowser is quit.
Min. Requirements A device with a screen