Closed Bug 1154663 Opened 5 years ago Closed 4 years ago
Msg can not be sent to a browser frame
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0 Build ID: 20141127110711 Steps to reproduce: 1 Homescreen add a new iframe to access to the specified URL。 2 When the new iframe is turned into a browser frame by setting the mozbrowser="true" attribut. Actual results: Homescreen can not postMessage to the browser frame which is on other domain. Code reference <iframe id="iframe" type="text/html" frameborder="no" mozbrowser="true" ></iframe> var iframe = document.getElementById('iframe'); iframe.contentWindow.postMessage('resume', 'http://www.xxx.com'); Expected results: Homescreen can postMessage to the browser frame which is on other domain.
Hi Josh, Can anyone take a look at this issue? Thx
>> Component: Gaia::Homescreen Component should be something like Gecko::browser-elements, not Gaia::Homescreen
Hi Jin, What error message do you see? Do you have log?
Flags: needinfo?(jocheng) → needinfo?(jz.zhangjin)
Hi Jin, Have you added the browser permission in manifest.webapp? https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Permissions
Hi Josh, The logcat has been added. Pls have a look at it. I'm afraid I didn't see the error message about postMessage.
hi yifan, We have added the browser permission in manifest.webapp.
Hi Tako, Is it possible for you to provide some part of the source code about this?
hi yifan, 1Pls add webui.html and webui_iframe.js in index.html. 2Pls load webUIIframe.show() in grid.js 3Pls load webUIIframe.resume() in visibilitychange event (homescreen.js) 4index.html and index.js are used for addEventListener on other domain such as http://172.24.220.132
In short, cross origin postMessage is prohibited. It would be easier to give you the best solution if we know the behavior or purpose of the embedded iframe. Generally if the embedded domain is under your control then we suggest you to use a backend server for communications. If you could make the iframe as a certified app, you could use Inter App Communications.
Mass update: Resolve wontfix all issues with legacy homescreens. As of 2.6 we have a new homescreen and having these issues open is confusing. All issues will block bug 1231115 so we can use that to re-visit any of these if needed.
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.