{"name":"htmlLoad","title":"htmlLoad","type":"command","url":"https://community.bistudio.com/wiki/htmlLoad","revid":369066,"updated":"2024-09-02T20:24:56Z","groups":["GUI Control"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","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.).\nThe command is subject to restrictions, imposed by CfgCommands class.\n\n> [!NOTE]\n> **Arma 3:** Since Arma 3 v2.10 the 'title' attribute is supported within <img> and <a> html tags\n\n> [!IMPORTANT]\n> For unknown reasons, URL's length is limited to 255 characters.","syntaxes":[{"syntax":"control htmlLoad filename","params":[{"name":"control","type":"Control","type_expr":"Control"},{"name":"filename","type":"String","description":"local file name or remote file URL","type_expr":"String"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"control"},"right":{"text":"filename"}}],"examples":[{"code":["_control htmlLoad \"briefing.html\";"]},{"code":["_control htmlLoad \"http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English\";"]},{"text":"Display news item:\n\n```sqf\n0 spawn {\n    disableSerialization;\n    private _html = findDisplay 46 createDisplay \"RscCredits\" ctrlCreate [\"RscHTML\", -1];\n    _html ctrlSetBackgroundColor [0,0,0,0.8];\n    _html ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH];\n    _html ctrlCommit 0;\n    _html htmlLoad \"http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English\";\n};\n```","code":["0 spawn {\n\tdisableSerialization;\n\tprivate _html = findDisplay 46 createDisplay \"RscCredits\" ctrlCreate [\"RscHTML\", -1];\n\t_html ctrlSetBackgroundColor [0,0,0,0.8];\n\t_html ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH];\n\t_html ctrlCommit 0;\n\t_html htmlLoad \"http://www.bistudio.com/newsfeed/arma3_news.php?build=main&language=English\";\n};"]}],"see_also":["ctrlHTMLLoaded","loadFile","preprocessFile","preprocessFileLineNumbers","HTML File Format"],"notes":[{"user":"BrotherhoodOfHam","date":"2014-09-07T18:02:00Z","text":"htmlLoad works with URLs as well as html files."},{"user":"Killzone_Kid","date":"2014-09-07T19:35:00Z","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.\nIt is therefore not recommended to use this command in such way."},{"user":"Benargee","date":"2015-04-21T18:08:00Z","text":"Example use of URL can be found in BIS_fnc_GUInewsfeed with the function browser."},{"user":"Tupolov","date":"2015-10-07T22:03:00Z","text":"(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:\n**Script**\n\n```sqf\n_newsOnline = \"http://alivemod.com/alive_news.php?map=\" + _map + \"&amp;mission=\" + _mission + \"&amp;player=\" + _player;\n_ctrlHTML htmlLoad _newsOnline;\n```\n\n**Config**\n\n```cpp\nclass CfgCommands {\n    allowedHTMLLoadURIs[] += {\n        \"http://alivemod.com/alive_news.php*\"\n    };\n};\n```"}]}