JavaScript in v4.0 - showing error message.

  1. 2 years ago

    Hello,

    I've put some Javascript into my PubCoder doc, into a smart object which has been working in v3.0 and now in the latest version 4.0 it's not working.

    I also tested your 'Hyper-Fishes' in v4.0 and it send out the same code but, in v3.0 it works like how mine does.

    This is my JavaScript (which works in v3.0 not 4.0)
    var hypeDocument = $("#obj5114 iframe")[0].contentWindow.HYPE.documents["Testimonials"];

    hypeDocument.showSceneNamed('Neoperl');

    hypeDocument.startTimelineNamed('Main Timeline', hypeDocument.kDirectionForward);

    Error message says:
    Script error.
    File:
    Line: 0

    Could you please help with this?

    Thanks,

    Ian.

    -image-

    file:///Users/Stilo/Desktop/JavaScipt%20error%20frame.png

  2. Angelo S

    27 May 2021 Administrator

    Hello Ian,
    it will work when exported to HTML or XPUB, it is a problem only in the preview.
    In 4.0, we updated to use a new WebView engine in the stage and preview (WKWebView) which has some security limitations when dealing with iframes and not running on a web server.

 

or Sign Up to reply!