AnsweredAssumed Answered

How can I display an alert if student is on certain IP address?

Question asked by Dave Patton on Oct 17, 2017
Latest reply on Oct 23, 2017 by Thomas Groot

My campus has a guest network that students are not supposed to use. Unfortunately, about 10-20% of our students use guest. This has not been a problem until recently when students have used LockDown Browser to take Canvas quizzes. The high latency causes the application to fail. 


In considering solutions, we had an idea that would be very tidy. Using custom code in our sub-account course theme, it should be possible to grab the user's IP address and insert an element on the page that warns them about using the guest network. We could then monitor last-login IP addresses until we are confident that students have configured the secure enterprise network. Then we can disable the function in the template.


I think the solution is going to use our sub-account custom course theme JS. All solutions I've explored so far have used a third-party tool to retrieve the IP address, which would probably fail due to cross-site scripting controls. However, since IP filtering is an option in Quizzes, my hope is that I could read the IP address easily from the session cookies or some other object. However, I can't seem to locate the IP if it indeed stored in an accessible location.


Can my Canvas template get the user's IP address without causing cross-site scripting errors?


Updated: Clarification and Precision.