0

I'm trying to load a web-application in a new popup window, which sits on a different domain from my application, using a post request (It has to be post request!). Internet explorer is giving me an access denied message when trying to access the document object of the window. I tried other answers posted in similar SO threads, but didn't have any luck...

Note: I can't use '' or 'about:blank' for the url, because IE considers it to be insecure.

Here is what my code currently does

  1. Create window Object
  2. Generate form in JavaScript
  3. Attach form to body of window. // access denied!

Code:

var win = window.open(url, windowname, params);
var form = $(document.createElement('form'))
              .attr('action', action)
              .attr('method', 'post');
$(win.document.body).html(form.html()); // access denied!
K Scandrett
  • 16,390
  • 4
  • 40
  • 65
HaloMediaz
  • 1,251
  • 2
  • 13
  • 31

1 Answers1

1

Do you have access to the source code of the content that will be loaded in the popup?

If yes try this:

Why not use static HTML to your pop-up window (i suggest you to use modals) and set the atributes by receiveing them from POST or GET params.

In less words: explore better your back-end and avoid to use DOM manipulation AND POPUPS.

If the answer is no:

Try this: https://stackoverflow.com/a/7397164/5261900

Community
  • 1
  • 1
Renoir Reis
  • 359
  • 4
  • 17
  • Thanks for the response I will try the second link you provided. Sadly I do not have access to the back-end code. If I did, I wouldn't even be using a POST request in the first place (especially when loading a window). :/ – HaloMediaz Nov 19 '16 at 02:19
  • @HaloMediaz maybe switching from popup to iframe can give you more ways to handle the DOM of the outside content. It can also prevent browser popup blocks. – Renoir Reis Nov 19 '16 at 02:31