Background: I have an Angular site, lets say it lives at(Production): (or localhost:4200) There is a chat page, the chat is inside an iFrame. The chat server lives at(Production): (or localhost:7078)

Goal: There is some text that displays at certain points of the chat (entering, dialog, ending, etc). It's currently hardcoded into the javascript in the ASPX file in the C# Project. I want to be able to display Spanish versions of these texts.

More background/What I've done for other parts of site: From the Angular site, I have LOCALE. For other parts of the site I can simply send this from an Angular service through our C# WebApi to get spanish version from DB

My Question is: What is the best way to get these translations? These are my thoughts:

  1. Can this still be done through some kind of API call (assuming that Angular and WebAPI live on a different server than ChatServer) ? Could I send the LOCALE from the Angular service to the WebAPI, then have an ajax call from CHATSERVER that accesses the same method from WebAPI to retrieve LOCALE?


  2. If this must be done in the javascript in the aspx, then... can I get around the CORS issues? I have looked at multiple SO articles and tried some different ways: this says you can't but there is a workaround. I tried the workaround but still get cross-origin error This shows a potential different workaround: . if this is valid, how does the mainpage postMessage get to the eventListener in a completely different project?

Since i've been spending hours on this already, I am looking for a general idea of best path to take forward.

Related posts

Recent Viewed