Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with IFrames and MS Edge #16

Open
PaitoAnderson opened this issue Jun 3, 2016 · 5 comments
Open

Issue with IFrames and MS Edge #16

PaitoAnderson opened this issue Jun 3, 2016 · 5 comments

Comments

@PaitoAnderson
Copy link

PaitoAnderson commented Jun 3, 2016

Running into an issue with MS Edge on Windows 10.

Basically the IFrame children can't communicate with the parent, here is a working example.

IE11 on Windows 7:
image

MS Edge on Windows 10:
capture

File1: TestPage.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test Outside</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/intercom.js/0.1.4/intercom.min.js"></script>
    <script type="text/javascript">
        var intercom = Intercom.getInstance();

        intercom.on('parent', function(data) {
            document.getElementById("data").innerHTML = data.message;
        });

        setTimeout(function(){
            intercom.emit('child', {message: 'Hello, Son!'});
        }, 500);
    </script>
</head>
<body>
    <h1>Outside</h1>
    <p id="data">Loading..</p>
    <iframe src="/TestPage2.html"></iframe>
</body>
</html>

File2: TestPage2.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test Inside</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/intercom.js/0.1.4/intercom.min.js"></script>
    <script type="text/javascript">
        var intercom = Intercom.getInstance();

        intercom.emit('parent', {message: 'Hello, Dad!'});

        intercom.on('child', function(data) {
            document.getElementById("data").innerHTML = data.message;
        });
    </script>
</head>
<body>
    <h1>Inside</h1>
    <p id="data">Loading..</p>
</body>
</html>
@PaitoAnderson
Copy link
Author

Ended up just writing a drop in replacement that uses .postMessage() and supports only what I need out of Intercom.js.

https://gist.github.com/PaitoAnderson/905060a611c47bac05b49040cf13260f

@sompylasar
Copy link

@PaitoAnderson why closed if the bug isn't fixed in Intercom.js?

@PaitoAnderson
Copy link
Author

@sompylasar Good point, I'll reopen 👍

@PaitoAnderson PaitoAnderson reopened this Jun 4, 2016
@jadrake75
Copy link

This library is used by our business software and it would be nice to have a fix on this.

Has anyone looked into whether there is a CSP directive that can be added to the iframe on inclusion to give it these "permissions" needed in Edge? Could the library use postMessage when Edge is detected so it is still a single API library?

@jadrake75
Copy link

jadrake75 commented Dec 20, 2017

According to Web and Offline Storage in local storage should be available across all windows that have the same origin.

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

No branches or pull requests

3 participants