Blacklist / whitelist urls allowed in application

I have a button that opens up a new browser
<button onclick="window.open('https://www.google.com', '_blank')">Google</button>

Is there a way i can restrict people from going to other urls from the application.
like i want to create a whitelist of urls which are allowed to be opened.

maybe in scripting onbeforeurl or onrouterurl ?

here is a way to block multiple website


function OnBeforeNavigate(NewURL, TargetFrame: String): Boolean;
begin
  // Convert NewURL to lowercase for case-insensitive comparison
  NewURL := AnsiLowerCase(NewURL);

  // Block Dropbox, Google, and other specific sites
  if (Pos("dropbox", NewURL) > 0) or 
     (Pos("facebook", NewURL) > 0) then
  begin
     
    Result := True; // Block navigation   
    ShowMessage("Access Denied! This website is blocked."); 
    Exit;
                                   
  end;

  Result := False; // Allow navigation if URL is not in the blocked list
end;
2 Likes