Forum Discussion
George71
Jul 07, 2020Brass Contributor
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!
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=&status=all&advFil=&IsSuggestedTerm=false&isFilterExpanded=undefined&CurrentScope.ForumName=msteams&CurrentScope.Filter=&ContentTypeScope=&page=1&sort=Relevance&dir=Desc
- ThereseSolimeno
Microsoft
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=&status=all&advFil=&IsSuggestedTerm=false&isFilterExpanded=undefined&CurrentScope.ForumName=msteams&CurrentScope.Filter=&ContentTypeScope=&page=1&sort=Relevance&dir=Desc
- George71Brass Contributorthanks! 🙂