How to load a default project at startup

I need a quick hack to load a default project at startup. Suggestions?

save a project and then share it and then use the link to it as the url you use to start Snap! instead of https://snap.berkeley.edu/snap/snap.html#

Sorry, I didn't specify that I need it for the offline Snap!, so I need to open a local file.

Hi Stefano, I'm also interested in this! AFAIK JavaScript cannot access non-JS files programmatically using the file protocol.

Yes, I guess you are right. But I could assign the content of the default xml file to a variable and then run an "open" command somewhere with that variable as an argument?

Yes, that should work.

Local files access is more and more restricted. Even if you manage to lower some restriction with the cmd line flags, the next browser version may ignore those settings.

.
There is a Web Server for Chrome extension Web Server for Chrome - Chrome Web Store

.
Or, Jens can expand the "-snap-backup-" idea to store default projects in local storage.

.
Snap: source code and media files have been whitelisted for offline use (sw.js). Maybe a some projects URIs can be stored, this way, too.

.
How deep is your offline mode? You want the whole :snap: to run from disk (allowing you to make your own version)? Or can run a shared LAN server?
Or use the SnaPP! way to bundle the :snap: and the project as a standalone app.
Yes I know, it's currently outdated and does not work with the v8 projects...

Interesting alternative

If this means storing in the browser cache, it wouldn't work for me

Can you tell me more about this?

The whole Snap! running from disk

I hadn't thought of this. This could be the perfect solution. Are there important reasons why this has not be updated to support v8?

There is an interesting option "Code accessible" that could be important to me (I'm implementing an introductory pseudo-language for high-school students). But, as you said, I got this error message:

So, any quick hack on where to add the automatic load at startup of a project stored in a js variable?

There is a list in Service Worker (sw.js)

 cacheName = 'snap-pwa',
 filesToCache = [
        'snap.html',
        'src/morphic.js',
        'src/symbols.js',
...

Browser cache or local storage is used.

It's not updated...

Maybe after it initalizes the ide. I'd suggest looking for where it loads thr cloud project from the url.

[offtopic]
:snap:
huh, didnt know there was a snap emoji

but its really squished
[/offtopic]

Is the offline Snap! you're using the PWA version or the downloadable ZIP file?

Downloadable zip. What is the difference with the PWA version? (And: where can I find it?)

I wanted to know because I think I have a solution that requires editing the source code a little bit. The good news is that you happen to be using the downloadable ZIP.

For chrome:
Just open a new Snap! instance, click on the three dots:
image

Then click "Install Snap!..."

Excellent! Let me know

I didn't know about this possibility (I started using Firefox two years ago for problems of Chrome with specific websites I use a lot). Do you know if there are advantages with respect to downloading the source files?

For a split second I thought this could be the perfect solution: when I installed Snap after opening the project I need as a defult, it showed me the Snap! webapp with the project open inside. But then, when I closed the app and reopened it, the project was gone :face_with_diagonal_mouth:

Before anyone says anything about my use of install, I said install, but meant "Create Shortcut". "Create Shortcut" is probably the solution to what you're looking for (in Chrome/Chromium-based services), and you can find it under "More Tools" when you press the three dots.

To my knowledge, when you open an installed app/thing/site it opens whatever link you installed. Pressing the install button on Snap! Build Your Own Blocks will result in always opening that window. However, if you install the Snap page with a public or shared project open in editor mode (it has a different link) it will install that.

TLDR:
Use Three dots -> More Tools -> Create Shortcut.
Doing this to snap.berkeley.edu/snap/snap.html will install the Snap! editor.
Doing this to snap.berkeley.edu/snap/snap.html#present:Username=USER&ProjectName=PROJECT will install the Snap! editor page with that project open.

I tried it. But when I then run the installed app in my mac, I get the empty Snap! UI.