Opening a file from a URL from a mod

On a copy of Snap!, on my own hosting, I can't access projects via Snap! cloud (as expected)

But I'm sure I was able to open up projects that I'd uploaded to my hosting but for the life of me I can't remember what the url syntax should be

As an example - how can I open up a Snap! example (using URL not via menu) on the same website?

https://cymplecy.gitlab.io/Snap/snap.html <----- what goes after this?

I'm having trouble figuring this out too, surely it would've just been https://cymplecy.gitlab.io/project?username=cymplecy&projectname=example right? Nope!

It can't be anything like that as our mods can't access Snap! cloud projects.

I used to have this working a few years ago but can't remember how I did it

I think it'll be something along the lines of
https://cymplecy.gitlab.io/Snap/snap.html#open: ....

I think you’ll need to provide the proper info to get arround CORS, unless GitHub doesn’t need that

There shouldn't be any CORS issue in accessing a file on same domain that the Snap! mod is running from :slight_smile:

Ah I didn’t quite understand what was going on, and yeah I’m not sure

The redirect url function is disabled in snap for obvious reasons so that could be the issue

Not sure what you mean?

What "redirect url function"?

In JavaScript, opening a webpage or redirecting to a url are both disabled in snap

i don't think you're getting it

Yeah I think I understand now. They are attempting to import a project file from another GitHub page

In that context I don’t think this is possible without a lot of modding the vm

no, they're trying to open a project that they've uploaded to their own hosting
i mean read the post dude

That’s what I said?
Importing is opening
And I said they are hosting it?

:rofl:

I'm glad your forum search skills are better than mine :slight_smile:

So, just to be explicit for anyone else trying this

https://cymplecy.gitlab.io/Snap/snap.html#open:https://cymplecy.gitlab.io/Snap/Examples/swimmer.xml

will open up the swimmer example project within my fork of Snap!

If it's on the same domain, e.g. in the examples folder, you can just put in a relative url, like this
https://cymplecy.gitlab.io/Snap/snap.html#open:Examples/swimmer.xml

Useful to know :slight_smile: