SOLVED

Cannot include local copy of javascript file in Teams App Tab

Brass Contributor

I’m trying to get a an HTML file to include a local javascript file but it does not seem to work in a Teams application tab. If I display the same HTML file in a web browser, it works fine.

 

For example, I have defined a string variable “newString” in the file “data.js” and then attempt to pick it up in the HTML file:

 

<head>
. . .
   <script type="text/javascript" src="data.js"></script>
. . .
   <p id="test1">original value</p>
. . . 
   <script type="text/javascript"> 
      document.getElementById("test1").innerHTML = "test:" + newString;
   </script>
. . .

 


I can see the value “test1” updated when I run it in Chrome but Teams does not seem to recognize “newString”.

 

I found this link which describes how to include MicrosoftTeams.min.js as a copied local file:
https://docs.microsoft.com/en-us/javascript/api/overview/msteams-client?view=msteams-client-js-lates...

According to the documentation, it should work. Does anyone know what the problem is?

 

Thanks!

 

2 Replies
best response confirmed by George71 (Brass Contributor)
Solution

Hi @George71   You may want to open a request at our answers.microsoft.com tech support site for more personalized service.  I did a search on javascript there and found these items already posted, but you can open a new one if you don't see anything that applies to your situation.  https://answers.microsoft.com/en-us/search/search?SearchTerm=javascript%20and%20teams%20app&tab=&sta...

1 best response

Accepted Solutions
best response confirmed by George71 (Brass Contributor)
Solution

Hi @George71   You may want to open a request at our answers.microsoft.com tech support site for more personalized service.  I did a search on javascript there and found these items already posted, but you can open a new one if you don't see anything that applies to your situation.  https://answers.microsoft.com/en-us/search/search?SearchTerm=javascript%20and%20teams%20app&tab=&sta...

View solution in original post