Explore the community Forums Lectora Lectora Questions & Answers retrieve page height for variable? – Responsive course Reply To: retrieve page height for variable? – Responsive course

#385937 Score: 0
Profile photo of Stan Miller
Stan Miller
LUC16 Attendee
wise owl
curious george
friend finder
LUC17 Attendee
37 pts

I’ve been working on something similar. Instead of covering the screen, I’m redirecting to a page that says “Please rotate your device.” That bit works great. Here’s what I did:

  1. Select the course title or the AU in the title explorer. (This makes the script available on every page, so if a learner leaves the course and returns in the middle, the script will still fire.)
  2. Insert tab > HTML Extension.
  3. Type Header Scripting.
  4. Paste in the script below.
  5. Add a page that says “Please rotate your device.” This page could of course be prettied up with a gif or what have you.
  6. Add an action to the AU: On Show | GoTo | The rotate prompt page created in step 5.

I was hoping that the built-in “On Device Rotation” action would let me redirect from there to the last visited page when the device is rotated. I added two such actions on the rotate prompt page, one to display a message and one to go to the last visited page. Sadly, though, it doesn’t work. On my Android device, I never even see the message. On my colleague’s iPhone, he sees the message but the GoTo action doesn’t work. I could easily put a button on the rotate prompt page to go back to the last visited page, but that’s clunkier than I like.

I know this isn’t exactly what you asked for, but it seems simpler than what you’re trying to do. I’ll post again if I figure out the return leg of this journey. (Happy for any suggestions anyone might have …)

var w = window.innerWidth;
var h = window.innerHeight;
if (h > w) {
else {