htmlLoad: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:Scripting Commands ArmA|" to "[[Category:Scripting Commands Armed Assault|")
m (Text replacement - "[] spawn" to "0 spawn")
 
(49 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma |Game name=
|game1= arma1
|version1= 1.00


|1.00|Game version=
|game2= arma2
____________________________________________________________________________________________
|version2= 1.00


| 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.
|game3= arma2oa
{{Warning | For unknown reasons, URL's length is limited to 255 characters.}} |DESCRIPTION=
|version3= 1.50
____________________________________________________________________________________________


| control [[htmlLoad]] filename |SYNTAX=
|game4= tkoh
|version4= 1.00


|p1= control: [[Control]] |PARAMETER1=
|game5= arma3
|version5= 0.50


|p2= filename: [[String]] - local file name or remote file URL |PARAMETER2=
|gr1= GUI Control


| [[Nothing]] |RETURNVALUE=
|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.}}


|x1= <code>_control [[htmlLoad]] "briefing.html";</code> |EXAMPLE1=
|s1= control [[htmlLoad]] filename


|x2= <code>_control [[htmlLoad]] "<nowiki>http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English</nowiki>"; {{cc|[http://www.bistudio.com/newsfeed/arma3_news.php?build{{=}}main&language{{=}}English link]}}</code> |EXAMPLE2=
|p1= control: [[Control]]


|x3= Display news item:<code>[] [[spawn]] {
|p2= filename: [[String]] - local file name or remote file URL
[[disableSerialization]];
_html = [[findDisplay]] 46 [[createDisplay]] "RscCredits" [[ctrlCreate]] ["RscHTML", -1];
_html [[ctrlSetBackgroundColor]] [0,0,0,0.8];
_html [[ctrlSetPosition]] [<nowiki/>[[safeZoneX]], [[safeZoneY]], [[safeZoneW]], [[safeZoneH]]];
_html [[ctrlCommit]] 0;
_html [[htmlLoad]] <nowiki>"http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English"</nowiki>;
};</code>|EXAMPLE3=
____________________________________________________________________________________________


| [[ctrlHTMLLoaded]], [[loadFile]], [[preprocessFile]], [[preprocessFileLineNumbers]], [[HTML File Format]] |SEEALSO=
|r1= [[Nothing]]
}}


<h3 style="display:none">Notes</h3>
|x1= <sqf>_control htmlLoad "briefing.html";</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x2= <sqf>_control htmlLoad "http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English";</sqf>
</dl>


<h3 style="display:none">Bottom Section</h3>
|x3= Display news item:
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<sqf>
[[Category:Scripting Commands Armed Assault|{{uc:{{PAGENAME}}}}]]
0 spawn {
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
disableSerialization;
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
private _html = findDisplay 46 createDisplay "RscCredits" ctrlCreate ["RscHTML", -1];
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
_html ctrlSetBackgroundColor [0,0,0,0.8];
[[Category:Command_Group:_System_Commands|{{uc:{{PAGENAME}}}}]]
_html ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH];
[[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]]
_html ctrlCommit 0;
_html htmlLoad "http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English";
};
</sqf>


<!-- CONTINUE Notes -->
|seealso= [[ctrlHTMLLoaded]] [[loadFile]] [[preprocessFile]] [[preprocessFileLineNumbers]] [[HTML File Format]]
<dl class="command_description">
}}
<dd class="notedate">Posted on September 7, 2014 - 18:02 (UTC)</dd>
<dt class="note">[[User:BrotherhoodOfHam|BrotherhoodOfHam]]</dt>
<dd class="note">
<br>htmlLoad works with URL's as well as html files.
</dd>


<dd class="notedate">Posted on September 7, 2014 - 19:35 (UTC)</dd>
{{Note
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|user= BrotherhoodOfHam
<dd class="note">
|timestamp= 20140907180200
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.
|text= [[htmlLoad]] works with URLs as well as html files.
</dd>
}}


<dd class="notedate">Posted on April 21, 2015 - 18:08 (UTC)</dd>
{{Note
<dt class="note">[[User:Benargee|Benargee]]</dt>
|user= Killzone_Kid
<dd class="note">Example use of URL can be found in [[BIS_fnc_GUInewsfeed]] with the function browser.
|timestamp= 20140907193500
</dd>
|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.
}}


<dd class="notedate">Posted on October 7, 2015 - 22:03 (UTC)</dd>
{{Note
<dt class="note">[[User:Tupolov|Tupolov]]</dt>
|user= Benargee
<dd class="note">
|timestamp= 20150421180800
(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>
|text= Example use of URL can be found in [[BIS_fnc_GUInewsfeed]] with the function browser.
'''Script Example''':
}}
<code>_newsOnline = <nowiki>"http://alivemod.com/alive_news.php?map=" + _map + "&mission=" + _mission + "&player=" + _player;</nowiki>
 
_ctrlHTML htmlLoad _newsOnline;</code>
{{Note
'''Config Example:'''<br>
|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 + "&amp;mission=" + _mission + "&amp;player=" + _player;
_ctrlHTML htmlLoad _newsOnline;
</sqf>
'''Config'''
<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>
};
</dd>
</syntaxhighlight>
</dl>
|game= arma3
<!-- DISCONTINUE Notes -->
}}

Latest revision as of 21:24, 2 September 2024

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.
Arma 3
Since Arma 3 logo black.png2.10 the 'title' attribute is supported within <img> and <a> html tags
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";
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

See also:
ctrlHTMLLoaded loadFile preprocessFile preprocessFileLineNumbers HTML 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 + "&amp;mission=" + _mission + "&amp;player=" + _player; _ctrlHTML htmlLoad _newsOnline;
Config

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