Better detection of Web Wizard APIs, close #2

This commit is contained in:
~lucidiot 2022-09-19 00:25:28 +02:00
parent a2c366a81a
commit 523d301d1e
1 changed files with 15 additions and 11 deletions

View File

@ -141,13 +141,6 @@ window.onload = function () {
runButton.onclick = run;
clearButton.onclick = console.clear;
// Try to detect the wizard extensions.
if (typeof window.external === 'object' && typeof window.external.SetWizardButtons === 'unknown') {
window.external.SetHeaderText('JavaScript Console', "Explore this wizard's JavaScript environment.");
// Enable the back button
window.external.SetWizardButtons(1, 0, 0);
}
if (/MSIE 7.0/.test(navigator.userAgent)) {
/*
* For some reason, IE 7 messes up the textarea's width and height
@ -161,7 +154,18 @@ window.onload = function () {
}
}
// An onback function is required by the web wizard specification
window.onback = function () {
window.external.FinalBack();
}
// Try to detect the wizard extensions.
if (typeof window.external === 'object') {
if (typeof window.external.SetHeaderText === 'unknown')
window.external.SetHeaderText('JavaScript Console', "Explore this wizard's JavaScript environment.");
if (typeof window.external.SetWizardButtons === 'unknown')
window.external.SetWizardButtons(1, 0, 0);
if (typeof window.external.FinalBack === 'unknown') {
// An onback function is required by the web wizard specification
window.onback = function () {
window.external.FinalBack();
}
}
}