Skip to content

Instantly share code, notes, and snippets.

@Splaktar
Last active June 21, 2023 18:40
Show Gist options
  • Save Splaktar/8198776 to your computer and use it in GitHub Desktop.
Save Splaktar/8198776 to your computer and use it in GitHub Desktop.
Enable Firebug Lite in a JavaFX WebView.
if (isDebugging())
engine.documentProperty().addListener(new ChangeListener<Document>() {
@Override
public void changed(ObservableValue<? extends Document> prop,
Document oldDoc, Document newDoc) {
enableFirebug(engine);
}
});
/**
* Enables Firebug Lite for debugging a webEngine.
* @param engine the webEngine for which debugging is to be enabled.
*/
private static void enableFirebug(final WebEngine engine) {
engine.executeScript("if (!document.getElementById('FirebugLite')){E = document['createElement' + 'NS'] && document.documentElement.namespaceURI;E = E ? document['createElement' + 'NS'](E, 'script') : document['createElement']('script');E['setAttribute']('id', 'FirebugLite');E['setAttribute']('src', 'https://getfirebug.com/' + 'firebug-lite.js' + '#startOpened');E['setAttribute']('FirebugLite', '4');(document['getElementsByTagName']('head')[0] || document['getElementsByTagName']('body')[0]).appendChild(E);E = new Image;E['setAttribute']('src', 'https://getfirebug.com/' + '#startOpened');}");
}
@grdk37
Copy link

grdk37 commented Jun 21, 2023

the webiste mentioned in this code canot be accessed any more.
after some search i got this one
https://cdn.bootcdn.net/ajax/libs/firebug-lite/1.4.0/firebug-lite.js

from https://blog.csdn.net/m0_60688978/article/details/127660395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment