htmlLoad: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Lou Montana (talk | contribs) m (Text replacement - "[] spawn" to "0 spawn") |
||
(90 intermediate revisions by 17 users not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=command | |||
|game1= arma1 | |||
|version1= 1.00 | |||
|game2= arma2 | |||
|version2= 1.00 | |||
|game3= arma2oa | |||
|version3= 1.50 | |||
|game4= tkoh | |||
|version4= 1.00 | |||
|game5= arma3 | |||
|version5= 0.50 | |||
|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. | |||
{{Feature|arma3|Since {{GVI|arma3|2.10|size= 0.75}} the 'title' attribute is supported within <img> and <a> html tags}} | |||
{{Feature|important|For unknown reasons, URL's length is limited to 255 characters.}} | |||
[[ | |s1= control [[htmlLoad]] filename | ||
|p1= control: [[Control]] | |||
|p2= filename: [[String]] - local file name or remote file URL | |||
|r1= [[Nothing]] | |||
|x1= <sqf>_control htmlLoad "briefing.html";</sqf> | |||
|x2= <sqf>_control htmlLoad "http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English";</sqf> | |||
|x3= Display news item: | |||
<sqf> | |||
0 spawn { | |||
disableSerialization; | |||
private _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"; | |||
}; | |||
</sqf> | |||
|seealso= [[ctrlHTMLLoaded]] [[loadFile]] [[preprocessFile]] [[preprocessFileLineNumbers]] [[HTML File Format]] | |||
}} | |||
{{Note | |||
|user= BrotherhoodOfHam | |||
|timestamp= 20140907180200 | |||
|text= [[htmlLoad]] works with URLs as well as html files. | |||
}} | |||
{{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. | |||
}} | |||
{{Note | |||
|user= Benargee | |||
|timestamp= 20150421180800 | |||
|text= Example use of URL can be found in [[BIS_fnc_GUInewsfeed]] with the function browser. | |||
}} | |||
{{Note | |||
|user= Tupolov | |||
|timestamp= 20151007220300 | |||
|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: | |||
'''Script''' | |||
<sqf> | |||
_newsOnline = "http://alivemod.com/alive_news.php?map=" + _map + "&mission=" + _mission + "&player=" + _player; | |||
_ctrlHTML htmlLoad _newsOnline; | |||
</sqf> | |||
'''Config''' | |||
<syntaxhighlight lang="cpp"> | |||
class CfgCommands { | |||
allowedHTMLLoadURIs[] += { | |||
"http://alivemod.com/alive_news.php*" | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
|game= arma3 | |||
}} |
Latest revision as of 21:24, 2 September 2024
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.
- 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";
- Example 3:
- Display news item:
0 spawn { disableSerialization; private _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
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
- Posted on Sep 07, 2014 - 18:02 (UTC)
- htmlLoad works with URLs as well as html files.
- 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.
- Posted on Apr 21, 2015 - 18:08 (UTC)
- Example use of URL can be found in BIS_fnc_GUInewsfeed with the function browser.
- 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
Configclass CfgCommands { allowedHTMLLoadURIs[] += { "http://alivemod.com/alive_news.php*" }; };
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: GUI Control