Support Log in

28. Modal Dialog Utility — `window.sfModal` (SF-119)

Developer Guide
Prefer video? Watch the Rank Forge tutorials 9 short guides covering every feature Watch

Drop-in Promise-based replacement for window.alert / window.confirm. Loaded globally on every Rank Forge admin screen via assets/js/sf-modal.js.

js
// Alert
window.sfModal.alert('Saved successfully.', { title: 'Done', variant: 'success' });

// Confirm (Promise<boolean>)
window.sfModal.confirm('Delete this redirect?', {
    title: 'Delete redirect?',
    okText: 'Delete',
    cancelText: 'Keep',
    variant: 'danger',
}).then(function (ok) {
    if (ok) deleteRedirect();
});

Variants: warning (default, orange), danger (red, for destructive actions), info (blue), success (green). Esc cancels, Enter confirms, clicking the overlay also cancels.

For graceful degradation if the modal script fails to load, wrap your call:

js
function sfAlert(msg, opts) {
    if (window.sfModal && window.sfModal.alert) return window.sfModal.alert(msg, opts);
    window.alert(msg); return Promise.resolve(true);
}

Forge AI Assistant Online

Hi! I'm the Rank Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs