ID:2718452
 
BYOND Version:514
Operating System:Windows 10 Pro 64-bit
Web Browser:Chrome 93.0.4577.82
Applies to:Dream Seeker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:

When using javascript's alert() and confirm() functions the dialog boxes will fail to appear at all when connected to a non-local server.

Code Snippet (if applicable) to Reproduce Problem:
src << browse("<a onclick=\"alert('Test!')\">Click me!</a>","window=test")


Expected Results:

Clicking the link shows an alert containing "Test!")

Actual Results:

Nothing happens.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Likely
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?

When running the code locally, even through Dream Daemon, things work fine. Joining a non-local server running the same exact code will result in all javascript dialogs not appearing, including error dialogs.

This is the same dumb behavior BYONDexe has when it comes to javascript and there's 100% no reason either should be suppressing anything.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Seems to be happening in every 513 version I tried as well.

Workarounds:

Don't use alert() or confirm()? Don't rely on javascript's error dialog to tell you when something is broken.

No need for a test case either, even the most basic of javascript fails in this case, the trick is hosting it off site to try it. It seems if it's running locally in any way the alerts appear.
On further testing, it's not failing if the world is hosted on my LAN either. It's failing consistently when joining a world hosted on a remote Linux box though.
More testing on the LAN using Windows:

The first time the window appears, the first alert() or confirm() hitting it will fail to display, but subsequent ones will show up.

So in this example you'd use a verb to call the browse() in the original post, the first time you click the text nothing will happen, the second time the alert() will appear. If you use the verb again to reload the content, the same thing happens.

In my real world usage of confirm(), it doesn't seem to be firing no matter what I do, but that's on a remote Linux box, so there may be a difference in what's happening on the server's end.

Okay, this appears to be caused by output() serving up the content wrong. As per Lummox, output() and browse() should be identical for showing a page, but they're not.

output() caches the text, then loads that cached content as a file://

browse() caches the text to a file (in a different location as output() even), then serves up that file from BYOND's internal local webserver.

Using browse() allows alert() and confirm() to work as expected, using output() does not.