Skip to content

MathType online version only works from http(s):// and not from 'about:srcdoc' #1150

@icc

Description

@icc

Description

We're attempting to integrate the wiris mathtype-generic editor into one of our tools but are running into an error message from the JsEditor component.

In order to separate our tool(JS+CSS) from the target page we're using an iframe with the 'srcdoc' attribute set. However, this does not appear to be compatible with JsEditor, we're running into the message produced by these lines:

        if (js.Lib.window.location.href.indexOf("http") != 0) {
            js.Lib.window.alert("MathType online version only works from http(s):// and not from '" + js.Lib.window.location.href + "'");
            return;
        }

We can work around this by using iframe.contentDocument.write() instead of srcdoc="", but due to 'Document: write()' being deprecated and strongly discouraged due to its significant performance and security flaws it would be really great if srcdoc could be supported by JsEditor.

A suggested solution could be to use window.origin instead of relying on the window.location.

Environment

Which version of MathType does this happen in?
8.11.1

What is the relevant software and their versions?

  • MathType triggered via a <button>
  • Vanilla JS
  • Chrome
  • Windows

Steps to reproduce

Try to launch the MathType editor from inside of an iframe with the srcdoc attribute set.

Expected result

MathType opens similar to when using document.write() instead of srdoc.

Actual result

MathType throws the error and doesn't start:
MathType online version only works from http(s):// and not from 'about:srcdoc'

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions