• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Pausing a project when user changes over to another browser window

Explorer ,
Dec 21, 2016 Dec 21, 2016

Copy link to clipboard

Copied

Hi,

I`m using Captivate 9 and I publish in HTML5.

Is there a way to automatically pause a project if the user changes over to another browser window? And to resume the project if the user changes back to the original window (in which the course is running)?

Maybe some JavaScript solution?

Thank you very much for any help!

Best regards

Michael

Views

278

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 22, 2016 Dec 22, 2016

Add this in the head of the index.html

<script>
function chkVisibilityChange()
{
if ( document.hidden )
{
     window.cpCmndPause = 1;
   }
else 
{
     window.cpCmndResume = 1;
   }
}

document.addEventListener("visibilitychange", chkVisibilityChange, false);
</script>

Likes

Translate

Translate
Community Expert ,
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

Add this in the head of the index.html

<script>
function chkVisibilityChange()
{
if ( document.hidden )
{
     window.cpCmndPause = 1;
   }
else 
{
     window.cpCmndResume = 1;
   }
}

document.addEventListener("visibilitychange", chkVisibilityChange, false);
</script>

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

Great answer! Thank you very much, this is exactly what I was looking for!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 08, 2020 Apr 08, 2020

Copy link to clipboard

Copied

LATEST

Good morning and thanks for your support. I have a little problem, I try to synthesize.

My client wants to avoid user open new window/program while he's watching the course.
I have tried this code and it works perfectly only if I open new browser window.

If I open new program (Teams, Outlook.. or a pdf) the course continues to run.

Could you please tell me how to fix this?
Thank you in advance.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines