Dash button with different potential outputs

I have a dash button that triggers some python code to run.

The output is either a message
-“you didn’t select anything, please select an item”,
-“you’ve selected too many items, please select ONE item”,
or if the user has selected an item, a link is displayed which the user can then click, to open a new tab in the browser with the selected item in the url. (something like href = ‘Google’ + str(item1))

Currently when I click the button, the messages display under the table of items (This is what I want to happen), but so does the link if the user picks an item. How can I make it so the link is automatically followed if the user selects an item, instead of displayed under the table?

Thank you!!