htmlLoad: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fiiix)
m (Some wiki formatting)
Line 18: Line 18:
|gr1= GUI Control
|gr1= GUI Control


|descr= Load [[HTML File Format|HTML]] from file or Uri using given control. File path is relative to current mission dir or an absolute path (with drive letter etc.). The command is subject to restrictions, imposed by [[CfgCommands]] class.
|descr= Load [[HTML File Format|HTML]] from file or URI using given control. File path is relative to current mission dir or an absolute path (with drive letter etc.).
{{Feature | Warning | For unknown reasons, URL's length is limited to 255 characters.}}
The command is subject to restrictions, imposed by [[CfgCommands]] class.
{{Feature | Important | For unknown reasons, URL's length is limited to 255 characters.}}


|s1= control [[htmlLoad]] filename
|s1= control [[htmlLoad]] filename
Line 45: Line 46:
}}
}}


{{Note
|user= BrotherhoodOfHam
|timestamp= 20140907180200
|text= <br>[[htmlLoad]] works with URLs as well as html files.
}}


<dl class="command_description">
{{Note
|user= Killzone Kid
|timestamp= 20140907193500
|text= While [[htmlLoad]] surprisingly does work with URLs as pointed above, the operation is blocking, meaning the whole game will freeze until the operation is complete.
It is therefore not recommended to use this command in such way.
}}


<dt></dt>
{{Note
<dd class="notedate">Posted on September 7, 2014 - 18:02 (UTC)</dd>
|user= Benargee
<dt class="note">[[User:BrotherhoodOfHam|BrotherhoodOfHam]]</dt>
|timestamp= 20150421180800
<dd class="note">
|text= Example use of URL can be found in [[BIS_fnc_GUInewsfeed]] with the function browser.
<br>htmlLoad works with URL's as well as html files.
}}
</dd>


<dt><dt>
{{Note
<dd class="notedate">Posted on September 7, 2014 - 19:35 (UTC)</dd>
|user= Tupolov
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|timestamp= 20151007220300
<dd class="note">
|text= ({{arma3}}) In order to use URLs, they must be included in CfgCommands -> allowedHTMLLoadURIs. In order to use URIs with params a wildcard * character is supported:
While surprisingly [[htmlLoad]] does work with URLs as pointed above, the operation is blocking, meaning the whole game will freeze until the operation is complete. Therefore it is not recommended to use this command in such way.
'''Script'''
</dd>
<code>_newsOnline = "http:/<nowiki/>/alivemod.com/alive_news.php?map=" + _map + "&amp;mission=" + _mission + "&amp;player=" + _player;
 
_ctrlHTML [[htmlLoad]] _newsOnline;</code>
<dt><dt>
'''Config'''
<dd class="notedate">Posted on April 21, 2015 - 18:08 (UTC)</dd>
<dt class="note">[[User:Benargee|Benargee]]</dt>
<dd class="note">Example use of URL can be found in [[BIS_fnc_GUInewsfeed]] with the function browser.
</dd>
 
<dt><dt>
<dd class="notedate">Posted on October 7, 2015 - 22:03 (UTC)</dd>
<dt class="note">[[User:Tupolov|Tupolov]]</dt>
<dd class="note">
(Arma 3) In order to use URLs, they must be included in CfgCommands -> allowedHTMLLoadURIs. In order to use URIs with params a wildcard * character is supported:<br><br>
'''Script Example''':
<code>_newsOnline = <nowiki>"http://alivemod.com/alive_news.php?map=" + _map + "&mission=" + _mission + "&player=" + _player;</nowiki>
_ctrlHTML htmlLoad _newsOnline;</code>
'''Config Example:'''<br>
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
class CfgCommands {
class CfgCommands {
  allowedHTMLLoadURIs[] += {
allowedHTMLLoadURIs[] += {
      "http://alivemod.com/alive_news.php*"
"http://alivemod.com/alive_news.php*"
  };
};
};
};
</syntaxhighlight>
</syntaxhighlight>
</dd>
|game= arma3
 
}}
</dl>

Revision as of 22:09, 21 September 2021

Hover & click on the images for description

Description

Description:
Load HTML from file or URI using given control. File path is relative to current mission dir or an absolute path (with drive letter etc.). The command is subject to restrictions, imposed by CfgCommands class.
For unknown reasons, URL's length is limited to 255 characters.
Groups:
GUI Control

Syntax

Syntax:
control htmlLoad filename
Parameters:
control: Control
filename: String - local file name or remote file URL
Return Value:
Nothing

Examples

Example 1:
_control htmlLoad "briefing.html";
Example 2:
_control htmlLoad "http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English"; // link
Example 3:
Display news item:[] spawn { disableSerialization; _html = findDisplay 46 createDisplay "RscCredits" ctrlCreate ["RscHTML", -1]; _html ctrlSetBackgroundColor [0,0,0,0.8]; _html ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH]; _html ctrlCommit 0; _html htmlLoad "http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English"; };

Additional Information

See also:
ctrlHTMLLoadedloadFilepreprocessFilepreprocessFileLineNumbersHTML File Format

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
BrotherhoodOfHam - c
Posted on Sep 07, 2014 - 18:02 (UTC)

htmlLoad works with URLs as well as html files.
Killzone Kid - c
Posted on Sep 07, 2014 - 19:35 (UTC)
While htmlLoad surprisingly does work with URLs as pointed above, the operation is blocking, meaning the whole game will freeze until the operation is complete. It is therefore not recommended to use this command in such way.
Benargee - c
Posted on Apr 21, 2015 - 18:08 (UTC)
Example use of URL can be found in BIS_fnc_GUInewsfeed with the function browser.
Tupolov - c
Posted on Oct 07, 2015 - 22:03 (UTC)

(Arma 3) In order to use URLs, they must be included in CfgCommands -> allowedHTMLLoadURIs. In order to use URIs with params a wildcard * character is supported: Script _newsOnline = "http://alivemod.com/alive_news.php?map=" + _map + "&mission=" + _mission + "&player=" + _player; _ctrlHTML htmlLoad _newsOnline; Config

class CfgCommands {
	allowedHTMLLoadURIs[] += {
		"http://alivemod.com/alive_news.php*"
	};
};