Is there a way to add a link/hyperlink to an alert popup box?

Rohit Shetty
Tera Contributor

Is there a way to add a link/hyperlink to an alert popup box?

alert("Please visit https://siteaddressgoeshere.com for more information");

 

I have already tried using

alert('<p>Please Visit <a title="Site Address" href="https://siteaddressgoeshere.com">Site Address</a> for more information</p>');

1 ACCEPTED SOLUTION

Akif_Shah
Kilo Sage
Kilo Sage

I don't think we can do this with an alert but you can try using this

altAlert('<p><span style="font-size: 12pt; color: red;">Please Visit <a title="Site Address" href="https://siteaddressgoeshere.com" target="_blank">Site Address</a> for more information</span></p>');

function altAlert(str) {
    if (typeof spModal != 'undefined') { //for portal
        spModal.open({
            message: str,
            title: 'Alert',
             buttons: [{label: 'OK', primary:true}
            ],
        });
    } else { //for platform
        var gm = new GlideModal();
        gm.setTitle('Alert');
        gm.renderWithContent(str);
    }
}

View solution in original post

2 REPLIES 2

Akif_Shah
Kilo Sage
Kilo Sage

I don't think we can do this with an alert but you can try using this

altAlert('<p><span style="font-size: 12pt; color: red;">Please Visit <a title="Site Address" href="https://siteaddressgoeshere.com" target="_blank">Site Address</a> for more information</span></p>');

function altAlert(str) {
    if (typeof spModal != 'undefined') { //for portal
        spModal.open({
            message: str,
            title: 'Alert',
             buttons: [{label: 'OK', primary:true}
            ],
        });
    } else { //for platform
        var gm = new GlideModal();
        gm.setTitle('Alert');
        gm.renderWithContent(str);
    }
}

Thank you, this works perfectly