|
Post by craz1000 on Apr 25, 2024 14:38:50 GMT
Saw this and instantly realized I can do ALOT with this. For example I can QBJS on my website and the landing page would be a program that is the website itself, a full multimedia site built on this platform and executing a program that mimics a website.
Question is i noticed you can load code and execute it using a link, and it looks like the link itself has the source in it under the "code=" part of the link. problem is if I were to make a graphically complex site that code is going to get very long and as a result the link will as well.
Is it possible to have it load up a .bas file that is located on the website and auto execute it, the same as the link with "mode=" and "code=kAKJfkjhaskufyiuheil... etc"?
|
|
dbox
Junior Member
![*](//storage.proboards.com/forum/images/stars/star.png)
Posts: 89
|
Post by dbox on Apr 25, 2024 15:31:32 GMT
Hi craz1000 ! Yes, you can certainly do that. There is an alternative "src" parameter that you can use if you want to point directly to a source file. The url would look something like: Note: The location from which you are hosting the file will have to allow cross-origin access.If your program has additional file resources you can save the whole project as a zip file and point to the zip file url with the same src parameter. I would also point out another option that is available... You can export a "compiled" version of your program through the Share/Export dialog. This will create a zip that just contains the compiled JS version of your program along with the necessary supporting html, css and js resources to run the application standalone. Then you can upload this to a game/app sharing site like itch.io as a web application.
|
|
|
Post by craz1000 on Apr 25, 2024 16:12:48 GMT
sweet
|
|
|
Post by craz1000 on May 11, 2024 23:59:39 GMT
New question. Cant seem to get a file download. I have an icon on the page using _put image and i can detect when i click on it but cant seem to initialize a file download
|
|
dbox
Junior Member
![*](//storage.proboards.com/forum/images/stars/star.png)
Posts: 89
|
Post by dbox on May 14, 2024 13:20:39 GMT
You can use the extended file IO library to initiate a browser download. Here’s the documentation page: github.com/boxgaming/qbjs/wiki/FS.DownloadFileHere’s a simple example. It assumes you have saved the file to the virtual file system: Import FS From "lib/io/fs.bas"
' Your code to save the file goes here
FS.DownloadFile "/test/img/logo.png"
|
|
|
Post by craz1000 on May 15, 2024 0:42:20 GMT
I saw that, the virtual FS wanted to save it as a zip file and i did not pursue it any further. The zip file in this case would be a few hundred megabytes, if I understand this correctly when the user loads up the site they will have to download that zip as part of the website as it is loading correct?
|
|
dbox
Junior Member
![*](//storage.proboards.com/forum/images/stars/star.png)
Posts: 89
|
Post by dbox on May 15, 2024 1:43:41 GMT
What kind of file are you trying to download when the user clicks the image? I’d be happy to put together a simple example.
|
|
|
Post by craz1000 on May 20, 2024 19:26:06 GMT
|
|
dbox
Junior Member
![*](//storage.proboards.com/forum/images/stars/star.png)
Posts: 89
|
Post by dbox on May 22, 2024 21:04:39 GMT
Oh, I see. You're wanting to download a file directly from a URL outside of your application. The FS.DownloadFile only works with the virtual filesystem at present. However, we can use a little bit of inline javascript to accomplish what you are wanting to do I think. Just add the following DownloadFile sub to the end of your program and then call it from wherever you wish to download the file from the URL:
[qbjs]https://qbjs.org/?code=RG93bmxvYWRGaWxlICJodHRwOi8vY3JhejEwMDAubmV0L2ZpbGVzL1N0ZXJlb3NwYWNlMi56aXAiCgoKU3ViIM1AKHVybCwgxDFuYW1lKQokSWYgSmF2YXNjcmlwdCBUaGVuCiAgdmFyIGxpbmsgPSBkb2N1bWVudC5jcmVhdGVFbGXEDigiYSIpOwogIGlmICjJTiB7CiDFAcQ8LmTHeCA9yXDEMn0KxyB0YXJnZXQgPSAiX2JsYW5rIsgZaHJlZiA9IHVybMQw6QCBYm9keS5hcHBlbmRDaGlsZCjELeUAhcU2Y2xpY2soxRDOM3JlbW92Zc8zZGVsZXRlxTo7CiRFbmQgSWbkAS4=[/qbjs]
I like what you have so far, very retro!
|
|
|
Post by craz1000 on May 24, 2024 15:39:50 GMT
Oh! I did not know you can put Javascript straight in. That solves a lot of issues, awesome!
|
|