Don't. Let the user decide if they want to open in a new window or tab, or not! If the web UI implements this it makes it much harder for a user to have a choice. Always leave the user in control.
@marjoleink I largely agree.