invalid target origin '' in a call to 'postMessage'

synergi
Mega Expert

I am getting an error with OpenFrame init timing out. There is an error appearing in the console:

js_includes_ng_chat.jsx?v=07-20-2017_1155&lp=Wed_Aug_23_21_31_14_PDT_2017&c=3_50:13386 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'.

      at doPostMessage (https://dev30207.service-now.com/scripts/app.ng_chat/js_includes_ng_chat.jsx?v=07-20-2017_1155&lp=We...)

      at Object.fireToWindow (https://dev30207.service-now.com/scripts/app.ng_chat/js_includes_ng_chat.jsx?v=07-20-2017_1155&lp=We...)

      at https://dev30207.service-now.com/scripts/js_includes_openframe.jsx?v=07-20-2017_1155&lp=Wed_Aug_23_2...

      at fireEvent (https://dev30207.service-now.com/scripts/app.ng_chat/js_includes_ng_chat.jsx?v=07-20-2017_1155&lp=We...)

      at Object.fireTop (https://dev30207.service-now.com/scripts/app.ng_chat/js_includes_ng_chat.jsx?v=07-20-2017_1155&lp=We...)

      at HTMLButtonElement.onclick (https://dev30207.service-now.com/navpage.do:196:2971)

If I connect the OpenFrame URL to point to my localhost I do not get this error but when running from a server the error returns. The code is exactly the same.

I did not have this issue in my previous developer instance.

Any assistance would be appreciated.

1 ACCEPTED SOLUTION

synergi
Mega Expert

OK I have had this issue since August and I have finally solved it so I wanted to add this to help anyone else facing the same issue.


When entering the url in the OpenFrame configuration I was entering it as this:


And I would get the error mentioned in my original post.   After some experimentation and some logical deduction I discovered that if I added a forward slash to the url just before the "?"


the error would not appear and the OpenFrame init would no longer time out. In fact everything would work as expected.


View solution in original post

3 REPLIES 3

corina
ServiceNow Employee
ServiceNow Employee

Hello Justing.



A search here may give you ideas https://www.google.co.uk/search?q=Invalid+target+origin+%27%27+in+a+call+to+%27postMessage%27.&oq=In...



Do you have SSO enabled on the problematic one?


If yes, you get the same after you disable it?


Hi Corina,


Thanks for the comment. I don't have SSO enabled anywhere nor am I using postMessage anywhere in the code.


Hence my confusion.



Thanks,


Justin


synergi
Mega Expert

OK I have had this issue since August and I have finally solved it so I wanted to add this to help anyone else facing the same issue.


When entering the url in the OpenFrame configuration I was entering it as this:


And I would get the error mentioned in my original post.   After some experimentation and some logical deduction I discovered that if I added a forward slash to the url just before the "?"


the error would not appear and the OpenFrame init would no longer time out. In fact everything would work as expected.