3

I didn't really find an answer to that question that fits my need so I decided to ask it here.

I have two javascript's scripts on two different chrome tabs I need them to communicate with each other.

I just need them to be able to exchange information. (status , etc...)

My problem is that one website is HTTP and one of them HTTPS. (at least that's what i think).

I tried the following: 1.Opening the window from the script (Can't control both windows using the script and doesn't let me because one is HTTP and one is HTTPS) 2.creating Cookies (Can't access another domain's cookies) 3.using postMessage (gives me an error that says failed to execute because the target doesn't match the origin)

I have searched for quite a while and couldn't find a solution.

What are my choices here? (These are two different tabbed windows in chrome). In your answer please provide an example as well.

description of postMessage error: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://*******') does not match the recipient window's origin ('https://*******').

Another approach might be that I create one script that will command these two windows at once , but i have no idea how to do it since I can't access the document property after opening a window.

NotGI
  • 458
  • 9
  • 21
  • 1
    "gives me an error that says failed to execute because the target doesn't match the origin" — So set the target correctly? – Quentin Apr 12 '15 at 17:23
  • Its because of the HTTP and HTTPS nothing to do with the origin or target – NotGI Apr 12 '15 at 17:25
  • Have you tried using an common intermediary? For example you could configure a Sockets.IO Server and make both domains comunicate with it. – josegomezr Apr 12 '15 at 18:52
  • I tried researching about it but I'm running my script through chrome , as far as I read it requires node.js and it isn't included in chrome by default – NotGI Apr 12 '15 at 19:12

1 Answers1

1

the target is on https, so you need to correct your target too to be on https, and how come you dont know what the other website is in, are you trying cross domain communication.. ?? Have a look at this AJAX cross domain call

this should help if i understand your problem correctly.

Community
  • 1
  • 1
Mebin
  • 109
  • 1
  • 2
  • 9
  • It does help , but my question does start with "I have two javascript's scripts on two different chrome tabs I need them to communicate with each other." I don't need the HTML code i need the website to remain interactive. – NotGI Apr 12 '15 at 18:47