ID:2927285
 
Resolved
javascript: links in the browser were breaking subsequent topic links when those links began with ? instead of byond://? like they should. IMPORTANT NOTE: The workaround letting users get away with starting URLs with ? as a shortcut for byond://? in the browser will be going away in BYOND 516, except for legacy projects. Update your HTML accordingly.
BYOND Version:515
Operating System:Windows 11 Pro 64-bit
Web Browser:Chrome 125.0.0.0
Applies to:Dream Seeker
Status: Resolved (515.1640)

This issue has been resolved.
Descriptive Problem Summary:

When using
href="javascript:functionName();"
in a link to call a JS function, clicking the link runs the js code but then causes Topic to cease functioning for that object. However, using
onclick="functionName(); return false;"
The js function works correctly without causing any issues for Topic.

Numbered Steps to Reproduce Problem:
  1. Click the problem link that calls the JS function
  2. Observe that Topic no longer functions for that object


Code Snippet (if applicable) to Reproduce Problem:
/client
show_map = 0

/client/verb/test_case()
var/html= {"
<html>
<head>
<title>Test JS Function</title>
<script>
function testFunction() {
alert('JavaScript function called successfully!');
}
</script>
</head>
<body>
<h2>Call Test JavaScript Function</h2>
<!-- Link using href with javascript: -->
<a href="javascript:testFunction();">I break Topic! (in 515.1638 and newer)</a><br>
<!-- Link using onclick attribute -->
<a href="#" onclick="testFunction(); return false;">I don't break Topic!</a>
<h2>Call Topic</h2>
<a href='?src=\ref
[src];action=test_case'>Topic Call Test</a>
</body>
</html>
"}

usr << browse(html, "window=test_case")

/client/Topic(href, href_list)
switch(href_list["action"])
if ("test_case")
alert(usr, "Topic is working")


Expected Results:

Clicking a link generates Topic calls

Actual Results:

Clicking a link using the
href="javascript:function();"
syntax breaks all Topic() calls for the owning client or datum indefinitely.

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


When does the problem NOT occur?

The problem does not occur when using the
onclick='function(); return false'
attribute instead of
href="javascript:function();"


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.)
The last working version was 515.1637.

Workarounds:
  • Use the
    onclick
    
    attribute for calling JavaScript functions instead of
    href="javascript:function();"
    

  • Have players downgrade to 515.1637
Lummox JR resolved issue with message:
javascript: links in the browser were breaking subsequent topic links when those links began with ? instead of byond://? like they should. IMPORTANT NOTE: The workaround letting users get away with starting URLs with ? as a shortcut for byond://? in the browser will be going away in BYODN 516, except for legacy projects. Update your HTML accordingly.
Spevacus resolved issue with message:
javascript: links in the browser were breaking subsequent topic links when those links began with ? instead of byond://? like they should. IMPORTANT NOTE: The workaround letting users get away with starting URLs with ? as a shortcut for byond://? in the browser will be going away in BYOND 516, except for legacy projects. Update your HTML accordingly.

Lummox and Spev maintaining the bug tracker