Exporting to an https web site

70 views
Skip to first unread message

Bruce Sherwood

unread,
Jun 18, 2017, 3:30:48 PM6/18/17
to Glowscript Users
As you probably know, when editing at glowscript.org you can click "Share or export this program" and get code you can copy onto your own web page. This week I discovered that this didn't work if your web site is a "secure" site (https instead of http). For security reasons an https site does not permit the use of http elements (one can link to an http site but not use elements from that site in your own site).

Now when you export a GlowScript 2.5 program (but not earlier versions), the code imports from copies of the GlowScript libraries at 


with the result that the exported code will run in a web page on an https site.

I'll also mention that I found that it was possible to place a GlowScript VPython program in an https Wordpress site, if you are able to import the "iframe" plugin. To insert the animation, use the following statement, where XYZ.html is the location of the animation in the web site.

[iframe src="https://XYZ.html" width="420" height="550" scrolling="no"]

Alt Bayar

unread,
Jun 25, 2017, 9:14:06 AM6/25/17
to Glowscript Users
Means I can, for example, embed something like this (http://www.glowscript.org/#/user/matterandinteractions/folder/matterandinteractions/program/01-3Dvector) directly in a wordpress blog page, and the simulation will be running within that page?

Bruce Sherwood

unread,
Jun 25, 2017, 1:59:50 PM6/25/17
to Glowscript Users
No, doing what you say will only let the viewer click on your link and see the program running in a separate web page. (Similarly, if you click on the link in your note you see the program run, but in a separate window.)

If on the other hand you want the program to run inside a Wordpress page you need to do the following:

First, in your Wordpress site, click Plugins, search for iframe, install iframe, and activate it. (Note however that a free Wordpress site may not give you the option to install a plugin, in which case you can't embed a program in a page or post.) Then,

1) While editing the VPython code, click "Share or export this program". The program must use GlowScript version 2.5 or later.

2) Copy the compiled code that is displayed.

3) Paste the code into a text editor and save the file as an .html file.

4) In your Wordpress editor, click Media and drag the html file onto the media page.

5) Click the icon for the file.

6) Copy the URL.

7) Edit the Wordpress page or post where you want to embed the program.

8) Click the "Text" tab in the editor.

9) At the location where you want to place the program, enter the following (where LINK is the URL you saved in step 6; you will need to experiment with the right width and height for your particular program):

[iframe src="LINK" width="420" height="550" scrolling="no"]

Bruce Sherwood

unread,
Jun 25, 2017, 2:17:15 PM6/25/17
to Glowscript Users
If you scroll the following blog article, you can see an example of a VPython animation appearing in a Wordpress post:

heafnerj

unread,
Jun 27, 2017, 5:56:12 PM6/27/17
to Glowscript Users
This certainly works, but when I do it I loose the mouse (trackpad really) and touch interface functionality for changing the view. The key-click-drag combinations bring up a popup menu. Can you replicate this?

Joe 

Bruce Sherwood

unread,
Jun 27, 2017, 9:36:51 PM6/27/17
to glowscri...@googlegroups.com
userzoom and userspin both set to False for this program. No, I'm not able to see a popup menu on Windows or Mac (except of course by right click, which brings up a web page menu).
Reply all
Reply to author
Forward
0 new messages