GP in a web browser

Questions about GP commands and how to do things

Moderator: MSandro

Post Reply
JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

GP in a web browser

Post by JohnM » Jun 3rd, '17, 20:34

[Note: This posting is an expanded and updated version of a post that appeared in the Announcements forum in December 2016.

GP runs in a web browser! You can run it at:

https://gpblocks.org/run/gp.html

(Note: For security reasons, the https: prefix is required to use the microphone for sound input in the Chrome browser. In the future, other browsers may also require that prefix to access the microphone or other browser facilities. If you don't need sound input, you can use either http: or https:)

A number of small GP projects are built into the browser version. You can open those projects by clicking the "open" button.

You can open your own GP projects in the browser by dropping the project file onto the browser window running GP. The file name must end in .gpp. You can import .png images and .wav sound files into a project by dropping them onto GP. Uploading files and opening projects is slow, so be patient.

If you create or modify a project using the browser version of GP, the "save" button will save it in your "Downloads" folder. In Firefox, the saved project has the name you gave it. In Safari and Webkit browsers, the file is called "Unknown" and you'll need to rename it manually. I'm not sure about other browsers.

If you put your project file on a server, you can make GP load that project on startup by adding the project URL after a hash mark (#) like this:

https://gpblocks.org/run/gp.html#gpbloc ... mplate.gpp

Browser GP is reported to run well on Chromebooks, although I don't have direct experience.

Browser GP runs on many mobile devices, with varying levels of performance. Of the mobile devices I have, the iPad Pro gives the best performance and has enough screen real estate to be useable. Browser GP also runs on the low-cost $89 Amazon Fire HD tablet. The performance isn't great, but simple things can be done. Browser GP also runs on phones. Although the screen space is pretty limited, performance isn't bad on my iPhone 6s Plus.

GP can go full-screen, a big help on small mobile device screens. Different platforms offer different ways to accomplish this. On platforms that support it, a "toggle fullscreen" button will appear at the top of the browser. Unfortunately, that feature is no supported in iOS browsers. In Safari on iOS or Chrome on Android, you can create a "home screen shortcut" to GP. When you open GP via that shortcut, it fills the screen. There does not seem to be a way to create a home screen shortcut on Amazon's Fire OS, but fortunately the "toggle fullscreen" works.

Keyboard input on Android devices is awkward because Android doesn't make keyboard events available as they are typed; you need to enter an entire word or phrase, then hit the enter key to push it to GP. Hitting the enter key by itself will insert a newline. When running on Android devices, a "backspace" button appears above the GP canvas. That button allows you to backspace or delete text in a GP window or field. It's not elegant, but it does the job, and so far I haven't found any other way to enter a backspace on Android.

The stand-alone version of GP offers better performance, better integration with the file system and copy-paste, and some additional features such as access to the serial port and TCP/IP sockets. The "Download GP!" forum will tell you how to download that version.

I'm interested in experience reports of Browser GP running in Edge, IE, Opera, and other browsers. I'm also interested in reports about running GP in the browser on Chromebooks. Is there a consisten performance difference between Intel-based and ARM-based Chromebooks?

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: GP in a web browser

Post by SimpleSi » Jul 4th, '17, 20:18

All seems fine with it using Chrome/Win10

Only thing is cloud blocks don't work but I'm assuming this is down to "some additional features such as access to the serial port and TCP/IP sockets"

Simon

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: GP in a web browser

Post by JohnM » Jul 5th, '17, 02:18

Yes, you're right. You can't use vanilla sockets in a web browser, only WebSockets, which do an extra handshake at the start of a connection. That said, we could certainly add WebSocket support to the browser version of GP and make the CloudData server handle the WebSocket handshake -- and probably will at some point.

I really wish the browser didn't have so many arbitrary limitations. Some of them, like the file system sandbox, are clearly necessary. But if you're going to have web sockets why not support ordinary BSD-style sockets?

-- John

Post Reply