RPTools / maptool

Virtual Tabletop for playing roleplaying games with remote players or face to face.

Home Page:http://rptools.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: External URLs opening in HTML5 frames, dialogs, and overlays

Baaaaaz opened this issue · comments

Describe the Bug

When clicking on an external absolute URL within a frame5, web content infrequently opens in a frame5 itself rather than in your third-party browser of choice and overwrites existing frame5 content.

While I was not able to work out how to reproduce this issue, I was able to mimic the observed issue behaviour consistently by using relative links in a frame5, dialog5, and overlay and setting the html <base> tag href attribute . Non-HTML5 frame, dialog, and chat seem not susceptible to this issue.

Furthermore if you also add <base target="_blank" /> into the <head> tag it will spawn some new different window (not MT themed, and not in the browser of choice) when clicking on the relative link.

Issue discussed here https://discord.com/channels/296230822262865920/1236275826295705690

To Reproduce

  1. Create a new campaign, and do whatever needed to run the following macro script, then click on the links in the frame5, dialog5, or overlay.
  2. Observe that absolute links open in your browser of choice, whilst relative links open in the frame5, dialog5, or overlay.
[h: vHTML = '
    <head>
        <base href="https://wiki.rptools.info" />
    </head>
    <body>
        <a href="https://wiki.rptools.info/index.php/Main_Page">Absolute link -> opens in browser</a>
        <br>
        <a href="/index.php/Main_Page">Relative link -> opens in MapTool frame5/dialog5/overlay</a>
    </body>
']
[frame5("URLTEST5"): { [r: vHTML] }]
[dialog5("URLTEST5"): { [r: vHTML] }]
[overlay("URLTEST5"): { [r: vHTML] }]

Expected Behaviour

External URLs should open in your browser of choice, not in MapTool.

Screenshots

After running macro in new campaign:
image

After clicking on relative links in frame5, dialog5, and overlay:
image

MapTool Info

1.14.3, 1.15.0-rc.3

Desktop

Windows 11

Additional Context

Nothing obvious in MT log file.