Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

It does not work in Firefox when using a dynamically created iframe with a text #463

Open
Tymvie opened this issue Jul 10, 2017 · 1 comment

Comments

@Tymvie
Copy link

Tymvie commented Jul 10, 2017

The iframe content is hidden after a short period of time
Unit test

@Tymvie Tymvie changed the title Does not work in Firefox when using a dynamically created iframe with a text It does not work in Firefox when using a dynamically created iframe with a text Jul 10, 2017
@musikele
Copy link

musikele commented Nov 6, 2019

Just hit this bug. Don't know how to overcome this because postscribe is used by a library that will inject my code. My test page is:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
</head>

<body>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/postscribe/1.4.0/postscribe.min.js"></script>
    <style>
        #mydiv {
            margin: 5px;
            padding: 5px;
            border: 1px solid red;
        }
    </style>

    <div id="mydiv"></div>
    <script>
        var ad = `
<div id="test"></div>
<script>var div = document.getElementById("test");
var iframe = document.createElement("iframe");
div.appendChild(iframe);
var iframeDocument = iframe.contentDocument;
var internalDiv = iframeDocument.createElement("div");
internalDiv.id = div.id;
var internalScript = document.createElement("script");
internalScript.src= "https://code.jquery.com/jquery-3.4.1.slim.min.js";
iframeDocument.open();
iframeDocument.write(internalDiv.outerHTML + internalScript.outerHTML);
iframeDocument.close();
<\/script>
`;

    postscribe('#mydiv', ad);
    </script>
</body>

</html>

In the iframe I should have seen jquery loaded, but it is not.

Is there any way to circumvent or hack this behaviour?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants