There are 3 options when it comes to embedding GeoGebra into your website. Which one is right for you depends on what you're planning on doing with it. You can embed:[br][list][*]GeoGebra activities [br]to include dynamic worksheets into your website[/*][*]GeoGebra activities with use of API [br]to include dynamic worksheets and interact with them on your website[/*][*]GeoGebra Calculator apps [br]to include GeoGebra Graphing Calculator, Geometry, 3D Calculator or Classic directly into your website[/*][/list]To get an idea about what's possible with embedding have a look at this [url=https://geogebra.github.io/integration]Collection of Examples[/url]. [br]
[size=200][color=#018575]Embedding Activities with use of API[/color][/size][br][br]Using the GeoGebra API gives you the power to interact with GeoGebra activities in a more sophisticated way. You can create buttons outside of an activity that show or hide objects, listen and react to events from the activity and much more. [br][br]Before you can start using the API please follow the steps described in [b][url=https://www.geogebra.org/m/umrknut3]Simple Integration[/url] [/b]to embed your activity into a div element (if you haven't yet). No matter if you want to embed Activities with or without use of API, the steps of embedding an Activity are always the same. A full description of the API is listed on the [url=https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_API]GeoGebra Apps API Reference[/url]. Usage of the GeoGebra API is included in our Software Licensing Agreement.
To get an idea about how to use the API, start with this simple example:[br][list][*]Create an activity with a triangle ABC and embed it into your website as described in [b][url=https://www.geogebra.org/m/umrknut3]Simple Integration Examples[/url][/b].[/*][*]Open the html file with your embedded activity and add the following code to add 2 buttons for setting point A visible and invisible.[/*][/list][code] [url=#]Hide point A[/url][br] [url=#]Show point A[/url][/code][br][list][*]Load your html file in the browser to see if the buttons work as expected.[/*][/list][br]To continue with more examples have a look at GeoGebra's [url=https://geogebra.github.io/integration]Collection of Examples[/url]. To see the corresponding code select [i]View on GitHub[/i] in the top right corner.
[size=200][color=#018575]Embedding GeoGebra Calculator Apps [/color][/size][br][br]The recommended way to embed a GeoGebra app into your website is to embed it directly as a div element. Using div embedding enables you to change settings of your app like the size of the app, showing or hiding the menu, disabling CAS and much more.[br][br]The easiest way to create an html file with a GeoGebra app embedded is to download an html file directly from the app as described below. You can also embed the app manually by following the steps further below.
You can create a webpage with a GeoGebra app embedded directly from any GeoGebra online or desktop app. Start the GeoGebra app you want to embed (e.g. [url=https://www.geogebra.org/graphing]GeoGebra Graphing Calculator[/url]) and open the [img]https://wiki.geogebra.org/uploads/thumb/8/8c/Ic_menu_black.svg/16px-Ic_menu_black.svg.png[/img] [i]Menu. S[/i]elect [i]Download as[/i] and then choose [i]Activity as Webpage (html)[/i]. The downloaded html file contains everything you need to start.
To embed GeoGebra Apps into your website, you need to add 4 parts:[br][br]1. Add the following to the [code]<head>[/code] section to make sure scaling and Unicode works correctly:[br][code]<meta name=viewport content="width=device-width,initial-scale=1"> [br]<meta charset="utf-8"/>[/code][br][br]2. Include the JavaScript library deployggb.js:[br][code]<script src="https://www.geogebra.org/apps/deployggb.js"></script>[/code][br][br]3. Create a div element where you want the activity to be loaded[br][code]<div id="ggb-element"></div>[/code][br][br]4. Configure and insert the app:[br] [code] var params = {[br] "appName": "graphing", [br] "width": 800, [br] "height": 600, [br] "showToolBar": true, [br] "showAlgebraInput": true, [br] "showMenuBar": true,[br] };[br] var ggbApplet = new GGBApplet(params, true);[br] window.addEventListener("load", function() { [br] ggbApplet.inject('ggb-element');[br] });[/code][br][br]If you want to load a different app, you can change the setting in the parameters list. Simply change the [code]"appName"[/code] parameter to [code]"graphing"[/code], [code]"geometry"[/code], [code]"3D"[/code] or [code]"classic"[/code].[br][br]Note: If you download an html file directly from the app as described above, the html file will contain these 4 parts. [br]These steps are the same as for embedding a GeoGebra Activity - the only difference being the parameters. Adding [code]"material_id": "RHYH3UQ8"[/code] will load an Activity into the app. Setting [code]"showToolBar": false[/code] will hide the Toolbar.
Open the html file and have a closer look at the [i]parameters [/i]list. You can change settings like the size of the app, showing or hiding the menu and much more. A complete list of settings is documented in the [url=https://wiki.geogebra.org/en/Reference:GeoGebra_App_Parameters]GeoGebra App Parameters Reference[/url]. All available paramters are included in our Plus Service Agreement.[br][br]When embedding a GeoGebra app, make sure to remove the parameter [code]"ggbBase64":"UEsD..."[/code] which was created while downloading the html file from the app.
We recommend that you self-host the GeoGebra Math Apps Bundle so that you can manage the timing of software updates but you are also welcome to use our global CDN backed by Amazon Web Services (AWS). Please see [url=https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_Embedding]GeoGebra Apps Embedding Reference[/url] for more details.[br]
You have more questions?[br]Contact us at office@geogebra.org[br]We're happy to help!