Add a "Legend" button when the topmost layer has a legend.

Clicking the button opens the legend URL in a separate tab.