Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Having problems with open-url (Twine 2.0.11, Harlowe 1.2.2)

Hello there! I am getting some unexpected behavior from the (open-url:) macro in Harlowe. I’m using the standalone Twine 2.0 editor, and I’m getting the same behavior in the built-in webkit browser, in Firefox, and in Chrome.

Here's a sample of the kind of code that is acting up:
(link: "Psalm 29")[(goto-url: ""https://www.biblegateway.com/passage/?search=Psalm+9&version=CEB";)]

When the link is clicked, the URL indeed opens in a new tab/window, just as expected. However, the link text disappears and “[object Window]” appears.

If I change (link:) to (link-reveal:), the words “Psalm 29” become plain text (as expected with (link-reveal:)) but “[object Window]” appears immediately thereafter, so the result is “Psalm 29[object Window].”

I’ve been working on this story for quite some time and I don’t remember seeing this behavior previously. I certainly never noticed the “[object Window]” before. Advice?

Comments

  • Your example has an extra double quote at the start of the URL.

    The (goto-url:) macro will replace the content of the current web-browser tab with the content of the referenced URL, so if the URL is valid you should not see the [object Window] text.

    By default when the link created by a (link:) macro is clicked it replaces the Link Text with the text (String) output of the associated hook, in this case that text is the String representation of the window object being used to open the URL.

    I could not replicate your error using the (goto-url: ) macro but I could using the (open-url: ) macro. If you plan on using the (open-url:) macro then the following CSS can be used to hide the [object Window] output, place it within your story's Story Stylesheet area.
    tw-hook tw-expression[name="open-url"] {
    	display: none;
    }
    
  • Thank you, greyelf. Yes, I carelessly typed (goto-url:) in my post but it is actually (open-url:) that is showing this behavior.
  • ...it is actually (open-url:)...
    You should create an issue on the Harlowe project web-site about the [object Window] output problem.

Sign In or Register to comment.