ID:261351
 
In my project I've got HTML files that will be displayed in the browser. However, I want to have links that call client.Topic() just like they were in the text output.

For example, I can do this:
world << "<A HREF='?help'>Help!</A>"

...and that becomes a valid link. When I click it, client.Topic() will be able to see "help" as one of the items in href_list and can go from there. However, if I put this same link in a browser file, well, things are a bit different:
usr << browse('justafile.html')

...
In justafile.html:
<HTML><A HREF="?help">Help!</A></HTML>

The problem is that this makes the mini-browser think the link is to justafile.html?help. What's curious is that I can't seem to put anything before the ? that would help. If I put in the name of the .dmb file, I get a response that says "The page cannot be displayed." If I put in a byond:// link, it says it's going to leave the world and open a new one from the link, which isn't what I want either. And, if I knew the exact right URL to put, would it be something static that I could include in the HTML file, or would it be something that might change, forcing me to build the HTML from scratch instead?

Now here's the real kicker: If the file for browse() is a text string, not a file, everything works perfectly. So this workaround is valid:
var/txt = file2text('justafile.html')
usr << browse(txt)

I could just go ahead and use this, but it seems wasteful and kinda stupid. Is there any way to just set the base for each link so I can just use the more straightforward syntax?

Lummox JR
Lummox JR wrote:
In my project I've got HTML files that will be displayed in the browser. However, I want to have links that call client.Topic() just like they were in the text output.

For example, I can do this:
world << "<A HREF='?help'>Help!</A>"

...and that becomes a valid link. When I click it, client.Topic() will be able to see "help" as one of the items in href_list and can go from there. However, if I put this same link in a browser file, well, things are a bit different:
usr << browse('justafile.html')
>
> ...
> In justafile.html:
> <HTML><A HREF="?help">Help!</A></HTML>


The default link type in the text panel is byond://, wheras the default type in the browser is http://. We've actually changed this a few times with the progression of the project, and since we might change it again we recommend just prefixing every link with the protocol type.

Have you tried using:
byond://?help

as your link?

If that doesn't work, there's a bug.
In response to Tom
Tom wrote:
Have you tried using:
> byond://?help
>

as your link?

Man one of these days I've gotta review the newer syntax...I did so much code the "old way" (or one of the old ways!) that I just copy and paste all the time and forget that there is a more HTMLy approach now...