Your code simply will not work as you want as you already have found out.
Redesign it. It's definitely possible. Check for example how standard Fact Sheet is opened in business partner. The button to Fact Sheet is placed in the same place as you place yours.
As you said you're opening some url. Which method do you use to generate it?