Skip to content

error when loading dai-debt.xml #1

@SmartLayer

Description

@SmartLayer

Access debt-dai.xml

Observe the IFRAMEs are empty and there is an error

Uncaught ReferenceError: loadIframe is not defined.

Later I realised that the debugger assumes the JS fiel to be in the same places as the TokenScript XML file, while I put the debuger (both xsl and js files) into a subfolder, hance the <script src="…" didn't work.

Suggested workaround:

In this version:

https://alphawallet.github.io/TokenScript-Examples/examples/AAVE/debt-dai.xml

I put JavaScript inside the xslt file:

                        <script type="text/javascript" charset="utf-8">
//<![CDATA[
function loadIframe(){
        var iframes = document.getElementsByTagName("iframe");
        for(var i=0; i<iframes.length; i++){
                var iframe = iframes[i];
                var textContent = iframe.textContent;
                var wrapper = document.createElement('div');
                wrapper.innerHTML = textContent;
                
                iframeContentDocument = iframe.contentDocument || iframe.contentWindow.document;
                iframeContentDocument.write(wrapper.innerHTML);
                iframe.textContent = "";
        }

}
//]]>
                </script>

Do you accept this as a solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions