Howdy, Stranger!

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

Error with replace macro near iframe

I have a passage with an embedded video above a line of text, and the line has a replace behavior. So when my passage reads
<iframe width="420" height="315" src=" frameborder="0" allowfullscreen></iframe>

Text to be replaced.

(click-replace: "Text to be replaced")[Text to replace with.]
clicking the text results in a Javascript prompt that tells me
Sorry to interrupt, but this page’s code has got itself in a mess.
Error: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://twinery.org"; from accessing a cross-origin frame.

(This is probably due to a bug in the Twine game engine.)
Assigning a name to the hook and using that name in the (replace:) macro fixes this (which is the proper way anyway), except if I want something a little more complex, like making the text replace itself several times, with one passage reading
<iframe width="420" height="315" src=" frameborder="0" allowfullscreen></iframe>

[(display: "OTHER PASSAGE")]<SomeHook|
and a second one called "OTHER PASSAGE" that says
{

(if: $HasThisHappened is 0)[
	This is the text to be replaced by
	(link: "this link")[(replace: ?SomeHook)[(display: "OTHER PASSAGE")]].]

(else-if: $HasThisHappened is 1)[
	This is the text to replace with the first time.
	(link: "Replace again")[(replace: ?SomeHook)[(display: "OTHER PASSAGE")]]?]

(else-if: $HasThisHappened is 2)[This is *second* replacement text. This could go on if I wanted.]

(set: $HasThisHappened to it + 1)

}
This approach, as far as I’ve been able to test it, runs smoothly if I test/run from the desktop app, but returns the same error as before if I’m compiling/running/testing from the browser one, or compiling from desktop: though the text does replace itself, several line breaks appear (ignoring the { } mark) and the new replace link (“Replace again”) refuses to work until I click it repeatedly, at which point Harlowe tells me
Printing this expression may have trapped me in an infinite loop.►
I almost ended up doing the same thing over and over, forever.
I get that I’m displaying a passage inside itself, but it’s structured so it doesn’t loop or anything, and it does work perfectly when the iframe isn’t there, even though none of the rest of the code actually touches the iframe.

So, question: Is there a clear reason why the desktop app doesn’t produce this error when testing? Is there a way to avoid it in the exported story?
Sign In or Register to comment.