Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Web Browser. i know it's possible.

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 13th May 2009 17:42
How do you display a downloaded web pAGE in dbc?

New Site! Check it out \/
spt games
16
Years of Service
User Offline
Joined: 14th Apr 2009
Location: United Kingdom
Posted: 13th May 2009 20:51
You mentioned "downloaded" so I guess you are after reading html files on the local hard disk. You would need to do something like:

1) Open the .htm/html file for reading
2) Parse the HTML tags and run the relevant commands, for instance using a sprite to display the "img" tag or creating "buttons" for hyperlink text. Obviously you would use the DBC text command to render text.

Something that works like a basic "Mosaic" (http://en.wikipedia.org/wiki/Mosaic_(web_browser)) should be fairly simple to put together in DBC - although I don't know how you could load files remotely?
Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 13th May 2009 21:09
Maybe I'm misreading your query, but couldn't you just save a lot of time and effort and simply use the "Execute File" command, passing in the location of the file top open, and allow the host computer's default web browser to open?

Just a thought...

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 14th May 2009 07:08
Ya you could do that i waS just wondering if you could display a web page inside dbc. i know it's for games but theres the ftp commands so i was just wondering. random question lol


Spt:

Ok thats all i needed. that would be pretty dang difficult. i would have to build essentially a HTML file scanner and convert to dbc wow hahaha

New Site! Check it out \/
spt games
16
Years of Service
User Offline
Joined: 14th Apr 2009
Location: United Kingdom
Posted: 14th May 2009 11:25
Not neccessarily difficult. It could be done for local files at least.

I'm not sure about using the FTP commands for downloading webpages, since it works differently to HTTP (the way Firefox, Internet Explorer, etc access web pages).

If you wanted to use FTP, you would need a user name and password for the site you want to connect to. Having a FTP user name and password for every web site would be impossible.

However, if it was you own FTP site you wanted to connect to, you could:

1) Log on to your FTP site

2) Download the html file, disconnect from the site.

3) Open the html file for reading, move through the file and extract the tags (put them in an arrays)

4) Iterate through the arrays and render using DBC "objects" (sprites, text, etc). If you wanted a scrollable page then each object would need to be rendered with a vertical offset from the "top" of the page.


This should work OK for basic web pages and would be an interesting DBC learning exercise (I'm half tempted to attempt it myself - but I'm busy lol). If you wanted the program to load pages that were online then you would probabaly have to make use of a DLL file.

However, if you simply want to take the user to your website using their default web browser then go the route that Robert The Robert suggests. Here's some code:

Login to post a reply

Server time is: 2025-06-08 05:20:25
Your offset time is: 2025-06-08 05:20:25