Forum Discussion

George71's avatar
George71
Brass Contributor
Jul 07, 2020
Solved

Cannot include local copy of javascript file in Teams App Tab

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-latest

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

 

Thanks!

 

Resources