Search code examples
javascripthref

Open new window with url built by javascript


What am I doing wrong?

<a href="#"onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/GetClients')">REST URL</a>

Right now all this is doing is moving me to the top of the page appending # to the url. I want it to open a new window with the resulting url. How can I debug this?


Solution

  • Does getBaseUrl() exist? Also you could put a space in there after the href="#" or remove the javascript: from the onclick attribute as onclick is already javascript.