Open link in new window

Hi guys.
I try to create a button that will open facebook for desktop in the browser and for mobile on the app.
it works great.
i just want the desktop one to be open in a new window.

can someone help me out ?

that’s my code:

import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;

export function iconButton1_click(event) {
//Add your code for this event here:

if (wixWindow.formFactor === “Desktop”) {
wixLocation.to(‘Redirecting...’);
}

if (wixWindow.formFactor === “Mobile”) [{]({
wixLocation.to(‘fb://facebook.com/DotsToLines/’);
}

})
[ wixLocation.to(‘fb://facebook.com/DotsToLines/’);]({
wixLocation.to(‘fb://facebook.com/DotsToLines/’);
}

})
[ }]({
wixLocation.to(‘fb://facebook.com/DotsToLines/’);
}

})

[}]({
wixLocation.to(‘fb://facebook.com/DotsToLines/’);
}

})

thanks a lot !!!

try this one instead:

import wixWindow from 'wix-window';
$w.onReady(() => {
    if (wixWindow.formFactor === "Desktop"){
        $w("#button1").link =  "https://www.facebook.com/DotsToLines";
    } else if (wixWindow.formFactor === "Mobile") {
        $w("#button1").link = "fb://facebook.com/DotsToLines";
    }
    $w("button1").target = "_blank";
})

Can it be done without buttons and just code?