$url = "https://example.com/scripts/alert.js?message=Hello, World!"; $escapedUrl = CUtil::JSUrlEscape($url); echo $escapedUrl;
var url = "https://example.com/scripts/alert.js?message=Hello, World!"; var escapedUrl = BX.util.urlencode(url); console.log(escapedUrl);In this example, the JSUrlEscape function is defined in the BX.util library that is included in various web development tools like Bitrix CMS. Determined package library: Bitrix CMS