Bug #4034
closedFile Open Dialog: WidgetSet mode and Cross Origin requests
0%
Description
Hi,
I have a Wt widget which is running on port 8080. I embedded it as a widget set in a page as shown below. The widget display and works perfectly fine (thank you!).
_
/div>
_
The bat file to start wt application looks like this:
_
REM Starts Wt server
set PATH=%~p0;PATH
set OLDPWD=CD
\"~p0\MyWtApp.exe\" ---docroot . ---http-port 8080 ---http-addr 0.0.0.0* ---config Config/wt_config.xml
_
The problem is I use FileUploadDialog to let users upload local file(s) and I get following error in widget set mode when the dialog is invoked.
_
Uncaught SecurityError: Blocked a frame with origin "http://localhost:8080" from accessing a frame with origin "http://localhost". Protocols, domains, and ports must match.
_
It works fine when Wt application is loaded in normal mode (ie; as a full pae application).
How can I fix it?
Thanks in advance!
-Prasad Dixit
Updated by Prasad Dixit almost 10 years ago
In IE file uploads successfully but not in Chrome. I believe, it is because IE doesn't include port into Same Origin components (http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy)
Updated by Wim Dumon almost 10 years ago
Referring to your stack overflow post, Wt uses 'The Cross-Origin Resource Sharing method' to tell a browser that the cross origin policy does not apply. What browsers work, what browsers don't work?
Best regards,
Wim.
Updated by Prasad Dixit almost 10 years ago
Hi Wim,
It works only in Microsoft's Internet Explorer. Sorry for using abbreviation 'IE' for Internet Explorer. In Google Chrome and Safari it doesn't work. I haven't tested Firefox. It works in Internet Explorer because Internet Explorer doesn't include port into Same Origin components, therefore http://company.com:81/index.html and http://company.com/index.html are considered from same origin and no restrictions are applied. (More info about IE's Same Origin Policy is here: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)
Thanks!
-Prasad
Updated by Koen Deforche almost 10 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
Updated by Koen Deforche almost 10 years ago
- Status changed from InProgress to Resolved
Updated by Prasad Dixit almost 10 years ago
Hi Koen,
I see it marked as resolved. What is the solution?
Thanks!
-Prasad
Updated by Koen Deforche almost 10 years ago
There's a fix in github: I've decided to use window.postMessage(). It should work on all browsers but haven't tested all (I don't have IE here right now).
Updated by Koen Deforche over 9 years ago
- Status changed from Resolved to Closed