Copy of Demo: plot graph in new tab
Button
function openInNewTab(url) {
var win = window.open(url, '_blank');
try {
win.focus();
} catch (e) {}
}
var func = ggbApplet.getValueString("f");
var func2 = encodeURIComponent(func).replace(/'/g, "%27").replace(/"/g, "%22").replace(/\)/g, "%29").replace(/\(/g, "%28").replace(/!/g, "%21");
openInNewTab("https://www.geogebra.org/graphing?command=" + func2)