Table of Contents

Web Document

Block Group: Browser API
Icon:Web Document block icon

Sends and retrieves a variety of information to and from the browser, including device information, header title, and search and hash strings.

This block has several uses:

This block always refers to the whole project, regardless of whether it is in the Project Dataflow or the dataflow for a different object.


Input/Output Properties

These properties can take input and give output.

title specifies the title for this web document. Typically, the user sees this title in the title bar of the browser window or tab. Only works in the Viewer.

hash sets or returns the string to appear after the hash (#) symbol in the URL. This allows you to create deep links and custom experiences based on data, properties, or user interaction. The hash value is saved across sessions and browser windows. The browser’s Back and Forward commands iterate through hash addresses.

zoom sets or returns the current zoom level. For example, a value of 2 means a zoom level of 200%.

initialScale only applies to mobile devices. It determines the zoom level at which the project is opened.

lockScale only applies to mobile devices. It determines whether zooming is allowed.


Output Properties

These properties can give output. They cannot take input.


Commonly Used Properties

These might be the most commonly used output properties:

width retrieves the width of the usable portion of the user’s browser window in pixels.

height retrieves the height of the usable portion of the user’s browser window in pixels.

screenWidth retrieves the width of the user’s entire screen in pixels.

screenHeight retrieves the height of the user’s entire screen in pixels.

URL returns the URL of this project.

protocol returns whether the project’s URL begins with HTTP or HTTPS.

host returns the path to the host of this project.

platform retrieves the platform the browser is running on.

pathname returns the pathname of this project. This is the portion of the URL after the protocol and host, and before any hash or search strings.

inIFrame returns whether this instance of the project is within an IFrame.

search returns the string that appears after the question mark (?) symbol in the URL. You can bind the search property to a Script block and use string functions, such as str.decodeUriComponent(), to parse it into a usable string.

language retrieves the language code of the browser.

isMobile returns whether the user is using a mobile device.

hasTouch returns whether the user’s device has a touch screen.

onBeforePrint fires before the browser window contents are sent to the printer dialog. You can use this for changing configuration to prepare for printing.

onAfterPrint fires after the browser window contents are sent to the printer dialog. You can use this for reverting changes made using onBeforePrint.


Less Commonly Used Properties

These might be less commonly used output properties:

pixelDepth retrieves the color depth or bit depth of the user’s screen, as reported by the browser. This is the number of bits used to determine the color of a pixel.

pixelRatio retrieves the ratio of the width to the height of each pixel on the user’s monitor, as reported by the browser.

userAgent retrieves the user–agent string, which identifies the browser and certain system details. It might not be accurate.

appName retrieves the name of the user’s browser. However, it is not a reliable source of information and often returns "Netscape" for various browsers.

appCodeName retrieves the internal code name of the browser. However, it is not a reliable source of information and returns "Mozilla" in most cases.

appVersion retrieves the browser version. It might not be accurate.

product always returns "Gecko," on any browser. It is not a reliable source of information.

productSub retrieves the build number of the browser.

vendor retrieves the vendor name of the browser.

vendorSub retrieves the version number substring of the vendor information. However, it is not a reliable source of information.


Model

This is a basic use of the block.

Dataflow Model Description
Web Document dataflow model The Web Document Block is sending a page title of "My Dashboard" to the browser. It is also saving a hash value of "localWeather." This hash value can be set by user action and can set other properties in DGLux5. It is saved across sessions and browser windows.