Project

General

Profile

Bug #4034

File Open Dialog: WidgetSet mode and Cross Origin requests

Added by Prasad Dixit over 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Target version:
Start date:
05/02/2015
Due date:
% Done:

0%

Estimated time:

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

#1

Updated by Prasad Dixit over 6 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)

#2

Updated by Wim Dumon over 6 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.

#3

Updated by Prasad Dixit over 6 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

#4

Updated by Koen Deforche over 6 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
#5

Updated by Koen Deforche over 6 years ago

  • Status changed from InProgress to Resolved
#6

Updated by Prasad Dixit over 6 years ago

Hi Koen,

I see it marked as resolved. What is the solution?

Thanks!

-Prasad

#7

Updated by Koen Deforche over 6 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).

#8

Updated by Prasad Dixit over 6 years ago

Thanks!

#9

Updated by Koen Deforche almost 6 years ago

  • Status changed from Resolved to Closed
#10

Updated by Koen Deforche almost 6 years ago

  • Target version set to 3.3.5

Also available in: Atom PDF