how to add a button in dashboard only using javascript?
Manipulating the content of a specific page requires that you be able to definitively identify that the page is what is loaded. As far as I am aware, the dashboard has a unique content ID that you can search for to determine if you are on the dashboard page.
1
2
3
4
5
6
// On Window Load
window.onload = (function() {
if(document.contains(document.getElementById('dashboard'))) {
// Code for dashboard-only button goes here
}
})();
However, on the slim chance that this ID is used on an alternate page, you can test the URL. Since the dashboard URL is always just the (sub)domain, it is relatively easy to test for:
if(/https?:\/\/(.[^\/]+)\/?$/.test(window.location.href)) {
I was able to successfully identify the dashboard between Beta, Test, and Live servers in Internet Explorer 11, Chrome 50, and Firefox 46 without issue. A dozen different pages were accessed to verify that neither option produced a false positive. Having said that, I would recommend the second option, simply because I can't promise the first won't result in a false positive.
The complexity of the (sub)domain is irrelevant, so long as there is no path beyond the initial URL.
Canvas Data Services sent out an alert that a course was concluded (because the course was concluded) and the status of each user in the UI is set to complete, however, the enrollments API endpoint shows the status of each user in the course as active. Is this a common issue? Have I misinterpreted how the individual…
How can one track Canvas Media use without having the reports available from Canvas Studio? Checking API endpoints and the Data 2 schema, there do not seem to be dedicated Canvas Media endpoints. Am I missing some? A method I've considered is using the body field of the wiki_pages table, as this contains the html code of…
Hello, I'm trying to utilize an API call to pull completed certificates and was hoping to download and store the certs as a backup. I can successfully run the API call but it will not allow me to view the certificate unless I access the URL while signed into an account where it's "my" cert. Is there a permissions setting…
UI for weekly progression idea that rest in the Schedule tab of the **K-12 UI** of Canvas it's incomplete and I really would not take it and push it into instance but I am going to post it here because in the past people like @James && @robotcars || @Steve_25 have had terrific input in the past... maybe w/their eyes and…
I have a new React + Flask webapp. It has its own login for users to start using the app. I have added this as an external tool in Canvas. What I want initially is to see of canvas users can start using the webapp without having to login if they click on the external tool link in a canvas course. I have 2 methods…