0

I have a web app, part of which opens a 3rd party page in a child tab (I'm unable to iframe it as the headers they send prevent it) Once the user has completed the 3rd party page, the 3rd party present a blank white page with a GET parameter in the URL of "SUCCESS".

I'd like to be able to interrogate the url from the main tab and if it contains "SUCCESS" close the child window.

This needs to be cross browser compliant and written using Javscript / Jquery Any ideas? is this possible?

Stu
  • 1
  • So you want to close the tab if "Success" is present in URL? – Pushprajsinh Chudasama Sep 18 '19 at 09:12
  • Yes, but this is in a child window containing a 3rd party url – Stu Sep 18 '19 at 09:18
  • I don't believe it's possible to do what you require, as the child window contains cross-domain content. As such you cannot read the URL from it from the parent window. Feel free to try it, though: https://stackoverflow.com/a/23388554/519413 – Rory McCrossan Sep 18 '19 at 09:21

1 Answers1

1

As far as i know (someone please mention otherwise), you can not trigger the browser to close an external page.
That would be a major security issue, imagine if you visited a site, and it decided to close all your other tabs ? Opens to many malicious possibilities..

Also regarding PWA, the possibilities are limited as to their power, depending on the phone, they run inside more or less restricted frames of the browser, especially on iOs..

Maybe you can look into “bypassing” the iframe restrictions, that way you’d simply be able to toggle it off with JS or even Css.
What are those restrictions, do you have code?

Also, how you invoked that 3rd party page to open in the background, could be relevant.

  • The iframe restrictions are due to "Refused to display 'https://########.###' in a frame because it set 'X-Frame-Options' to 'sameorigin'. – Stu Sep 18 '19 at 09:35
  • What are you using that 3rd party frame for, is it an audio/video file. Could you maybe input whatever it is directly from its URL and not through the whole frame? – I'm a TI calculator Sep 18 '19 at 10:29
  • Its a verification page from a 3rd party, following an API integration I've done – Stu Sep 19 '19 at 11:03