Page MenuHomeFeedback Tracker

Expand onHTMLLink event handler
Acknowledged, WishlistPublic

Description

Please make onHTMLLink fire when clicking on links to sections. Currently it only fires when clicking an external link.

Details

Legacy ID
2655333559
Severity
None
Resolution
Open
Reproducibility
N/A
Category
Feature Request

Event Timeline

Mikeeeyy set Category to Feature Request.Feb 16 2016, 5:02 AM
Mikeeeyy set Reproducibility to N/A.
Mikeeeyy set Severity to None.
Mikeeeyy set Resolution to Open.
Mikeeeyy set Legacy ID to 2655333559.May 8 2016, 1:44 PM

I would appreciate this too, having the event fire even when the link is not valid would be perfect for triggering other scripted events from custom dialog or htmlLoad.

If the link is invalid it could be ignored, by default, or the event handler could be changed to expect a boolean return to prevent/allow the url opening - in the same way that "InventoryOpened" can be blocked with a {true}

Example:

"You can <a href='doExtraCommand'>click here</a> to perform a scripted action"

//Link check
_testCtrl ctrlAddEventHandler ["HTMLLink", {
	params ["_ctrl", "_link"];
	if (_link == "doExtraCommand") then {
		[] spawn {
			systemChat "Running extra command...";
			...
		};
	};
}];

//Event handler boolean return
_testCtrl ctrlAddEventHandler ["HTMLLink", {
	params ["_ctrl", "_link"];
	if (_link == "doExtraCommand") then {
		[] spawn {
			systemChat "Running extra command...";
			...
		};
		//Prevent the link from opening
		false;
	} else {
		//Allow the link to open
		true;
	}
}];