Global Variables

Applies to HTML Viewer, IE Browser publications.

Global variables can be used by HEScript and JavaScript scripts to share data and store values in the publication. Each HEScript script is run separately by a single engine, so they cannot share variables: you need to use global variables if you want to share data between two scripts for instance.

You can manage global variables using:

They are better and more secure than cookies. If you were using cookies in your JavaScript code, we recommend you to switch to global variables. Please see the cookies topic.

Properties

Global variable names are unique and must contain only alphanumeric characters (without any space). In general, your global variables should never begin with “HE” because such variables may be used internally by HTML Executable.

Global variables may be persistent or temporary; a persistent variable is stored in the publication, in other words the variable and its value are saved in the publication’s state file and loaded the next time the publication is run. A temporary variable will exist only for the current session. You determine whether a variable is persistent or not when you set its value using the SetGlobalVar method.

Global variables are not shared between several running instances of a publication, but you can force all of the instances to have the same global variables by calling the SynchronizeGlobalVar function.

List of pre-defined global variables

Global Variable NameDescription
HELasterrormessageWhen an error occurs, this variable contains the error message.
DefWinTitleThe title of the main window.
HomePageThe index page’s filename.
HEPubStorageLocationThe path where the publication stores its data. You can customize it.
HEPubTempPathThe path to a temporary location where the publication stores its external files temporarily. This will change each time.
HEPublicationDiskInfoContains the device ID returned by Windows of the USB disk on which the publication EXE lies.
CurPageTitleThe title of the page which is currently displayed.
FwdButtonEnabledIs the forward button enabled? (true/false)
BackButtonEnabledIs the back button enabled? (true/false)
IEHighLightResultsBoolean (0 or 1, 1 by default). If set to 1, search words will be highlighted in an IE browser publication.
LastSearchQueryThe last search query.
HEPublicationFileThe full path to the publication’s .exe file (including filename)
HEPublicationPathThe full path to the folder that contains the publication’s .exe file (no filename). It will always include the path trailing backslash (e.g. C:\MyPath\).
HEPubRegisteredBoolean (0 or 1). Indicates whether the publication is registered or not. 0 = Trial ; 1 = Registered. Only available in a Restricted Publication.
HEPubUserNameContains the name of the registered user. Only available in a Restricted Publication.
HEPubUserData1Contains the company name of the registered user. Only available in a Restricted Publication.
HEPubExpiredBoolean (0 or 1). Indicates whether the trial period is over or not. Only available in a Restricted Publication.
HEPubDaysContains the number of remaining days in the trial period. Only available in a Restricted Publication with a trial period, based on number of days.
HEPubRunsContains the number of times the publication has been started in the trial period. Only available in a Restricted Publication with a trial period, based on number of runs.
HEPublicationOnUSBBoolean (0 or 1). Tells you whether the publication is on a USB drive or not. In order to be used, GetManualHardwareID(1) must be invoked first. For example, using this global variable lets you decide whether a publication may be run or not.
HEURLShowInPopupTitleBoolean (0 or 1). Allows IE publications to display URLs in popup titles. If set to 1, if you display an external website in a popup window, the popup will bear the URL to that website until it is completely loaded.
HEBuiltInServerHostContains the root URL to the local built-in server if the latter is active. Scheme: http://localhost:[port]/ (only for IE publications).
heenablectxmenuforpopupBoolean (0 or 1). Tells whether context menu should be enabled for popup windows or not. Default is false.
HECheckDebugBoolean (0 or 1). Tells you whether a debugger was detected or not.
HEInternetCachePathContains the path to the local Temporary Internet Files folder (only for IE publications).
HEShowPDFBookmarksBoolean (0 or 1). Enables the display of the navigation bookmark panel at startup: when the PDF is loaded, its bookmarks are automatically listed. By default, it is set to 0.
HESearchRelevanceNoDisplayBoolean (0 or 1). Lets you disable the display of relevance data in search results. By default, it is set to 1.
HEDongleLicCountFor enkySL dongles. Contains the trial frequency value.
HEDongleTrialDayFor enkySL dongles. Contains the trial days value.
HEDongleExpirationDateFor enkySL dongles. Contains the authorization expiration date in year/month/day value.

You should only read the values of these variables and not set their values yourself, except for IEHighLightResults & HEURLShowInPopupTitle.

How to call HEScript procedures/functions?


Copyright G.D.G. Software 2018. All rights reserved