0

I encountered the same problem as posted at https://www.reddit.com/r/geogebra/comments/s7mo26/geogebra_es6_module_web_integration/. Namely, if you try

<script type="module">
  import 'https://cdn.geogebra.org/apps/deployggb.js'

  const el = document.getElementById('ggb')
  const params = { appName: 'classic' }
  const applet = new GGBApplet(params, true)
  applet.inject(el)
</script>

it fails when the page loads with

Uncaught ReferenceError: __gwt_getMetaProperty is not defined
  at B (deployggb.js:5:36382)
  at webModule (deployggb.js:5:38593)
  at injectHTML5Applet (deployggb.js:5:14606)
  at continueInject (deployggb.js:5:4385)
  at Object.GGBApplet.applet.inject (deployggb.js:5:3255)

How can you use GGBApplet from a module if you can't guarantee there is a

<script src="https://cdn.geogebra.org/apps/deployggb.js"></script>

element in the webpage your module is being loaded from?

Glen Whitney
  • 446
  • 2
  • 12

1 Answers1

0

The method/workaround I found that worked for me is

import "https://code.jquery.com/jquery-3.7.1.js"

jQuery.getScript('https://www.geogebra.org/apps/deployggb.js', () => {
  const el = document.getElementById('ggb')
  const params = { appName: 'classic' }
  const applet = new GGBApplet(params, true)
  applet.inject(el)
})

(Note that I am reposting the question here and providing this possible answer because the original question on Reddit is archived and no longer accepting comments.)

Glen Whitney
  • 446
  • 2
  • 12