Hosting and Sharing NetLogo Web Models
This page covers how to host your NetLogo model files on the web, how to create shareable links and embeddable links using NetLogo Web, and how to use version-pinned embeddable links for reproducibility.
If you want to share your NetLogo model in a way that won't require users to open the model in NetLogo desktop or upload it to NetLogo Web, you will need a website host to store your files and display them. If you already have a website, then you have a website host and can skip the rest of these recommendations. If you don't have a website, one popular option for a simple static website host is GitHub Pages. Common website platforms like Wix and SquareSpace should support hosting NetLogo models or static HTML files. There are many other options, and all you need is a simple, static website in order to host NetLogo models. In the future, we're hoping to provide a service just for hosting NetLogo models to make things even simpler.
Once you have a website host, the next choice you have is to post your models as standard .nlogox
files and hotlink them to NetLogo Web, or to post exported HTML files of your models. If you plan to post many models,
or expect to make updates to models fairly frequently, hotlinking to NetLogo files will likely be easier as you won't
have to re-export new HTML pages each time you make an update. If you are just posting a single model as a one-time
thing, then posting the exported HTML page might be simpler. Below are some further benefits to each method.
Benefits to hotlinking your model to netlogoweb.org:
- Network resource usage will be reduced. Every hot-linked model uses the same code from netlogoweb.org, which your web browser can cache and re-use. If you have multiple models on a page, this will greatly reduce the download size of your pages and speed up loading times as models are much smaller than exported HTML files.
- The update process is simpler. When you update your model where it's posted on your website host, the places you link to it will also be updated. You do not have to re-export and post a new HTML file with each model update.
- Your model will automatically get bug fixes, performance enhancements, and other improvements that are made to NetLogo Web.
If you want to hotlink your model, see the hotlinking section below for more information.
Benefits to using a static HTML export with "Save as NetLogo Web":
- No network access to another site (netlogoweb.org) is required. The model and code to run it are self-contained. This can be a benefit in an environment where network access is very restricted.
- You do not have to worry about setting up cross-origin resource sharing (CORS) access from your website host to
netlogoweb.org. CORS settings are common and usually easy to change for most website hosts, but if your host is restrictive you may need to use exported HTML files for your models instead. More information on CORS is in the CORS section below.
If you want to post the static HTML version of your model, your website host's documentation should include information on how to do so.
Another option for sharing your model and linking directly to pages containing NetLogo Web models is to use the Modeling Commons, which is a public space for uploading, sharing, and discussing NetLogo models. All models uploaded to the Modeling Commons have integration with NetLogo Web through the Run in NetLogo Web tab on the model's page. For any model, if you open that Run in NetLogo Web tab and then copy your browser's current URL, that URL can be used for direct access to the NetLogo Web version of the model.
There are two kinds of hotlinks you can create for your model, depending on how you want it to be used. Both require your model to be posted on a website host accessible to the Internet. See the hosting options section above for more information. You can use the NetLogo Web Model Link Creator to generate either type of link automatically.
Shareable Links
A shareable link opens the full NetLogo Web interface with menus, toolbar, and all. It is the best choice when you want someone to be able to run, explore, or modify the model, and is well-suited to sharing via email, social media, or a course page.
- Get the URL of your model as posted on your website host.
- For example:
https://octocat.github.io/MyNetLogoModel.nlogox
- For example:
- Create a shareable link using
https://netlogoweb.org/launch#myModelURL.- For example:
https://netlogoweb.org/launch#https://octocat.github.io/MyNetLogoModel.nlogox
- For example:
- Open the link in a web browser to confirm your model loads and runs correctly.
Embeddable Links
An embeddable link loads a borderless view of your model. It will have no NetLogo Web menus or toolbar, which is
appropriate for placing in an iframe on your own website. Embeddable links also support
version pinning.
- Get the URL of your model as posted on your website host.
- For example:
https://octocat.github.io/MyNetLogoModel.nlogox
- For example:
- Create an embeddable link using
https://netlogoweb.org/web?url=myModelURL.- For example:
https://netlogoweb.org/web?url=https://octocat.github.io/MyNetLogoModel.nlogox
- For example:
- Open the link in a web browser to confirm your model loads and runs correctly.
- On the page where you want to display the model, add an
iframeelement whosesrcis your embeddable link.
For example, here is what a basic HTML page that embeds the model might look like:
<html>
<head>
<title>NetLogo Model Embedding Example</title>
</head>
<body>
<p>NetLogo Model Embedding Example</p>
<iframe
src="https://netlogoweb.org/web?url=https://octocat.github.io/MyNetLogoModel.nlogox"
width="600" height="600">
</iframe>
</body>
</html>
By default, both link types always run your model using the latest version of NetLogo Web. If you need embeddable links that stay fixed to a specific version, see the version-pinned links section below.
Cross-Origin Resource Sharing (CORS)
One common issue in hotlinking models is making sure that your website host allows
cross-origin resource sharing
(CORS) with NetLogo Web. Essentially this is a way for your website host to tell the web browser that it's okay for
NetLogo Web to load resources, even though they are different websites. Some website hosts, such as GitHub Pages, are
permissive by default and you won't have to make any changes to get them to work. If your website host is not
permissive by default, you might need to have your host set the Access-Control-Allow-Origin header in the
.nlogox file's HTTP response to either * or whichever NetLogo Web domain you're using,
https://netlogoweb.org or https://netlogo-web.org. This is a common setting for website
hosts, and they should include some way to update it for your website's files.
Embeddable links use the latest version of NetLogo Web by default. This means your models automatically receive new features, performance improvements, and bug fixes over time as we continue to work on NetLogo Web. However, there are situations where you may want an embeddable link to run your model against a specific, fixed version of NetLogo Web instead:
- Research reproducibility - ensure that others running your model get the exact same NetLogo Web behavior you used when collecting results.
- Bug workarounds - if a newer version of NetLogo Web introduced a regression that affects your model, you can pin to an older version while waiting for a fix.
- Avoiding breaking changes - new versions of NetLogo Web occasionally change behavior in ways that may affect your model.
Version-pinned links use a specific versioned build of NetLogo Web instead of the latest release. They look like standard hotlinks but use a versioned path:
- Latest (default):
https://netlogoweb.org/standalone?url=myModelURL - Pinned to a version:
https://netlogoweb.org/versions/2.15.0.html?url=myModelURL
To generate shareable links, latest embeddable links, and version-pinned embeddable links all at once, use the NetLogo Web Model Link Creator. Paste your model's URL into the tool and it will generate ready-to-use links for every available option.