UI: One Button to Open Variable URLS?

I have a panel with copy I can populate from a function, the panel also has a button, which depending on the active function, I want to open a specific URL.

The panel button is specified via: public Button getUrl;

An example of a typical function is:

 public void f_B01()
    {
        DisplayPanel.SetActive(true);
        ProductName.text = "Cylinders and Actuators";
        ProductDesc.text = "The leading global manufacturer of hydraulic cylinders.";
       // This doesn't work:
        getUrl.OpenURL("http://website01.com/");
      
    }

Each function has a unique URL, how do I get the panel button to get the url in each function and open it?

This is the current error I’m getting:

error CS1061: ‘Button’ does not contain a definition for ‘OpenURL’ and no accessible extension method ‘OpenURL’ accepting a first argument of type ‘Button’ could be found (are you missing a using directive or an assembly reference?)

Thanks.

You’re trying to get the button component to open the URL, and the button component doesn’t have that ability. Try Application.OpenURL instead.

I assume you mean that you want to open that URL when the button is clicked, in which case you’ll need to write a function for the button to call when it’s clicked, assign that function to the buttons OnClick event, and write the function such that it accesses the currently-appropriate URL (presumably stored in a variable somewhere) and calls Application.OpenURL() or something similar.