top of page
Buttons:
Behavior:
The same behavior noted below tested on Chrome, Firefox and Safari (MAC OS)
#Button2
Pressing this button creates a new browser window displaying the test PDF, keeping the active browser window on this page
#Button1 (Hidden Underneath Button2)
#Button3
Standard Wix Button with no code, with PDF Linked to the button.
Pressing this button creates a new browser window displaying the test PDF, changing the active browser window to the displayed PDF. This is the preferred behavior I am looking for.
Quesion:
How can the code below be modified so the behavior of buttons 1& 2 mimic the behavior of button 3?
WixCode on this Page:
When user activates Button2, the code below adds a time stamp to a database named "Analytics."
import wixData from 'wix-data';
import wixLocation from 'wix-location';
let Button1;
$w.onReady(function () {
Button1 = $w("#Button1").link;
$w("#Button2").target = "_blank";
});
export function Button2_click(event) {
let toInsert = {
"title": "PDF Downloaded"
};
wixData.insert("Analytics", toInsert)
.then( (results) => {
wixLocation.to(`${Button1}`);
} )
.catch( (err) => {
let errorMsg = err;
} );
}
bottom of page