Embed a Shared Code

Embed a file you have already saved and shared in JDoodle.

Note: This page only explains how to embed a file you have already stored and shared in JDoodle. For general embed plugins without saving and sharing a file, please refer - IDE Plugin.

To include a shared file in your webpage or blog, follow the below steps.

  • Save the program in JDoodle

  • Share the program (It can be either Editable Share or Instant Share)

  • Copy the Embed URL

  • Include the below HTML code on your page - replace the src with the URL you copied in the previous step

<div data-pym-src="https://www.jdoodle.com/embed/v0/2"></div>

and include this line at the bottom of your HTML file

<script src="https://www.jdoodle.com/assets/jdoodle-pym.min.js" type="text/javascript"></script>

Customisations

To customise you can pass the below parameters with the URL

ParameterDescription

stdin

0 to hide the STDIN box. By default, the STDIN box is displayed.

args

0 to hide the Arguments box. By default, the arguments box is displayed.

rw

1 to make the editor editable. By default, the editor is read-only.

set_args

Values for the arguments box.

Example URL Customisations

https://www.jdoodle.com/embed/v0/2?stdin=0&arg=0 - hides stdin and argument boxes

https://www.jdoodle.com/embed/v0/2?arg=0 - hides only arguments box, but displays stdin.

https://www.jdoodle.com/embed/v0/2?stdin=0&set_args=1 2 3 - hides stdin box, and sets values to arguments

Demo/Sample Page

Accessing/downloading a shared program

You can also download the shared programs in three different file formats:

https://www.jdoodle.com/api/get-share/<fileEmbedCode>?format=text
https://www.jdoodle.com/api/get-share/<fileEmbedCode>?format=json
https://www.jdoodle.com/api/get-share/<fileEmbedCode>?format=xml

<fileEmbedCode> is the unique number in the Share/Embed URLs.

Sample File

Note: Stored as .txt for security. Please save the file with ".html" extension.

Last updated