Open New Window/Tab via API

Hello, I’ve customized my instace of discourse to take a user to a specific page when they click on the community logo in the top right. It’s just a customized theme, in the header section:

<script type="text/discourse-plugin" version="0.4">
  api.changeWidgetSetting('home-logo', 'href', 'https://custom-url-here')

is there any way to make it open the url in the new browser tab?

This may help.


Thanks for the sugestion! I have checked the thread you linked and added a , target:'_blank' to api.changeWidgetSetting. Unfortunately this causes an error and clicking on the top logo takes you back to discourse homepage -

The code below was taken from a reply marked as a solution in a previous topic.

<script type="text/discourse-plugin" version="0.4">
api.decorateWidget('header-buttons:after', helper => { 
const showExtraInfo = helper.attrs.minimized; 
if (!showExtraInfo) { 
return helper.h('', {href:'', target:'_blank'}, 'Visit our blog'); } 


did you visit this topic reply?


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.