MS Teams Tab - file download on Android and iOS clients - microsoft-teams

Is there a way how to force MS Teams native client for iOS and Android to download a file from a custom Teams tab?
Currently it only tries to preview the file content which is useless.
I'm trying to download a file using a simple anchor link rendered within my Tab/web page that is displayed in MS Teams client. This works for all of the Teams desktop clients (native or web) as well as for detached tab (tab opened in a browser app e.g. Chrome) on iOS and Android platforms.
This is the Tab web app code:
<!DOCTYPE html>
<html>
<head>
<title>MS Teams test page</title>
</head>
<body>
<a href="/download" target="_blank" download>Download</a>
</body>
</html>
With Express server as backend serving file this way:
const express = require('express')
const path = require('path');
const app = express()
app.use(express.static('public'))
app.get("/download", (req, res) => {
res.set("Content-Disposition", "attachment;filename=archive.zip");
res.set("Content-Type", "application/octet-stream");
res.sendFile("AuthTest.zip", {
root: path.join(__dirname, 'dl'),
dotfiles: 'deny',
headers: {
'x-timestamp': Date.now(),
'x-sent': true
}
});
});
app.listen(80)
I also tested download using an iFrame element created via jQuery that targeted the download URL with the same result - iFrame showing a content preview instead of downloading it.
There's similar problem on Android as well where the app will open web browser app instead of downloading the file within the MS Teams app.

Currently when you give target and download a file will work on the desktop/web browser in teams , but it will not work on the mobile clients. This is by design. You need to upload the file to teams first and then download the file from files tab in mobile clients. Could you please check this sample which shown how to download an inline image in teams.

Related

How enable MathJax functionality on Heroku

I am kinda new to both the Python language and the Heroku web interface to web-app deployment. My background is engineering, and MATLAB programming so the whole rails/web scene is new to me. But I am trying to learn the basics for an upcoming project. Towards this end, with the help of a few tutorials around the web, I have managed to successfully couple of Python/NumPy + Flask based apps:
https://matrix-spectrum.herokuapp.com/
https://plot-damped-sinusoid.herokuapp.com/
But as you can already see, in the second link, the LaTeX/MathJax mark-up is not displaying correctly. Whenever I run it on my localhost it works correctly (heroku local web), but once it is deployed that MathJax does not display.
How do I fix this? Why isn't adding:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
equationNumbers: { autoNumber: "AMS" },
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
in the header working? The closest question/answer I can find is:
https://groups.google.com/forum/#!topic/mathjax-users/Rpa_WQ6rMkE
But that is about 5 years, old and I suspect there should be more recent developments like:
https://github.com/pmq20/mathjax-rails
But I have no experience with "rails".
Those links use the HTTPS (encrypted HTTP) protocol, but modern browsers often refuse to load unencrypted content if the main connection is encrypted. This is called mixed content.
Your link to load the MathJax library hard-codes an unencrypted HTTP connection:
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
You could switch http:// for https://, but a better approach is probably to simply use //:
<script type="text/javascript"
src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
This makes your link protocol-relative; it will load using the same protocol as the page itself.
I encourage you to learn about your browser's developer tools, which are a great resource when doing web development. The console included there often reveals this type of problem.

VBA generated Ajax 7 script won't display a Bing map in my access web browser control

I'm trying to generate Bing map ajax scripts on the fly depending on user selections in an access form. I would like to be able to display the map in an Access web browser control.
The problem is that two identical looking htm files act differently.
Good.htm loads in access, IE, firefox and opera fine.
Auto.htm, the one generated by code, opens in opera, firefox with no bugs in firefly, but not in access. It opens in IE but with the pop-up "Internet Explorer restricted this webpage from running scripts or ActiveX controls". When I click the "Allow blocked content" button it loads fine.
It will not load in access, if I put buttons in they will show, but the map won't.
I wrote a program to check both files for any differences in characters, there are none.
I can copy the script from auto.htm and paste it into good.htm and it will still be good.
One thing I did notice though, is that the properties that windows reports for good.htm, oddly, has "This file came from another computer and might be blocked...". If I click "unblock" then it will no longer work. auto.htm doesn't have that restriction.
I made good.htm by copying the html from "Bing Maps V7 Interactive SDK" and pasting it into a text file, them changing the extension to .htm.
For what it's worh, here's the script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"enter code here"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Map view (bounds)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
var map = null;
function getMap()
{
var boundingBox = Microsoft.Maps.LocationRect.fromString("42.3262, -83.8191, 42.2322, -83.6713");
map = new Microsoft.Maps.Map(document.getElementById('myMap'),
{credentials: 'my basic developer key',
bounds: boundingBox,
heigth: 590,
width: 850
});
}
</script>
</head>
<body onload="getMap();">
<div id='myMap' style="position:relative; width:850px; height:590px;"></div>
</body>
</html>
You could try adding the "Mark Of the Web":
Http://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

Don't prompt a user to install an app when trying to load a custom URL scheme

I have a page where I want to redirect users to the Instagram app when it's installed. That part works well, but when the user doesn't have the app installed it prompts them to go to the app store and download the app, which is not what I want.
I'm seeing this behavior on OS X in Safari, and the HTML involved is ({username} would be populated by my application based on the user submitting the form):
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0; url=instagram://user?username={username}">
</head>
<body>
<div>
Taking you to Instagram...
</div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
setTimeout(function() {
window.location = "https://instagram.com/{username}";
}, 200);
});
</script>
</body>
</html>
EDIT
Specifically, what's happening is the line <meta http-equiv="refresh" content="0; url=instagram://user?username={username}"> is showing the following dialog:
I'd like for that dialog not to display and let the "window.location =" in the take over and redirect the user to Instagram within the browser.
My question is how can I modify the "instagram://" redirect to not ask users to install the Instagram app on their machine?
There is no (official) way to detect in the browser if an app (like Instagram) is installed and thus you cannot use a custom url scheme without offering an alternative. You should let the choice to the end-user and prompt to open the website (https scheme) or the app (Instagram scheme).
The user will know if the app is installed.
If you know already that the user has the Instagram app installed, you can look at the browser agent to see if you are on an iOS device.

Google analytics doesn't work on my heroku app

I run a python web app on heroku platform,
using heroku sub domain like: example.herokuapp.com
and I add google analytics js code to my page:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxxx-x', 'herokuapp.com');
ga('send', 'pageview');
I have insert this script over 12 hours, but when I enter my ga account admin panel, it tell me:
The Google Analytics tracking code has not been detected on your
website's home page. For Analytics to function, you or your web
administrator must add the code to each page of your website.
however, I still can see some PV on the report panel
Does the ga work or not? How can I solve this problem? If I use a top level domain could solve this problem?
Two things regarding your ga.create() call:
1) The third parameter ("herokuapp.com" in your case) is supposed to be a Javascript object, not a plain string. Did you actually mean {'cookieDomain': 'herokuapp.com'}?
2) If you did... then it should be example.herokuapp.com -- you can't set a cookie on all of herokuapp.com.
I've found that the new universal analytics is actually a little slow to kick in within the interface. The old Google analytics used to be like this and could take a day to work.
I have set up universal analytics on 6 sites now, I could see the calls being made to google but it took a day for data to show.
Have you used any debugging tools available.
For Firefox httpfox is a great tool, once installed select start and filter by 'collect' this will display analytics calls if they are working.
In chrome there are 2 good extensions, tag assistant and ga debug both by Google. Both of these can help identify implementation issues.
Hope this helps
John
Credit: https://towardsdatascience.com/advancing-to-professional-dashboard-with-python-using-dash-and-plotly-1e8e5aa4c668#cf77
Try this
import dash
app = dash.Dash(__name__)
app.index_string = """<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131327483-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-131327483-1');
</script>
{%metas%}
<title>{%title%}</title>
{%favicon%}
{%css%}
</head>
<body>
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>"""

Phonegap online method and window.location

I'm new to phonegap and I'm still trying to understand the basics. I want to make a simple app that when it starts up it checks to see if it has an internet connection and if it does I want it to redirect to a website or load that website in the web view. If it doesn't have an internet connection, then I want it to stay on the app and just display static content.
Here's what I have so far.
<!DOCTYPE html>
<html>
<head>
<title>Online Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
document.addEventListener("online", onOnline, false);
}
// Handle the online event example
//
function onOnline() {
window.location.href ="http://google.com";
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
I also set OpenAllWhitelistURLsInWebView to true.
Does the online event only work if the app was offline then gets called when the app goes back online?
Thanks in advance!
No, Online event is fired when the app starts if internet is connected and it is also called when the app goes from offline to online mode.
If you want to open a external website in phonegap you can add a child browser plugin for the same Or else you can open a website in a embedded webveiw. window.location.href doesn't work in Phonegap.
I don't know whether you are working on iOS or Android so the link for iOS and for Android
Move your wiring up of the online event handler (i.e. this line):
document.addEventListener("online", onOnline, false);
up into your onLoad() function. I found that the online/offline events need to be registered on load, rather than later for some reason.

Resources