Show different image / animation depending on what browser being used?

HelpXplain is the exciting new animated infographics and screencast tool that integrates with Help+Manual.

Moderators: Alexander Halser, Tim Green

User avatar
Darren Rose
Posts: 180
Joined: Sat Mar 03, 2012 3:01 pm

Re: Show different image / animation depending on what browser being used?

Unread post by Darren Rose » Thu Jun 25, 2020 1:37 pm

Update script below as previous one only went to specified slide, if you actually want it to go to a specified slide and then play that slide and next slide(s) then you need to replace "xplain.goto(3,true);" with "xplain.play(3);"

Code: Select all

</script>
<script src="https://cdn.jsdelivr.net/npm/bowser@latest/es5.js" type="text/javascript"></script>
<script>
	var result = bowser.getParser(window.navigator.userAgent);
  //document.write("You are using " + result.parsedResult.browser.name + " " + result.parsedResult.engine.name);
  console.log("You are using " + result.parsedResult.browser.name + " " + result.parsedResult.engine.name);
  if (result.parsedResult.browser.name === "Microsoft Edge" && result.parsedResult.engine.name === "Blink" ) 
  {
   	//document.write("Microsoft Edge (Chromium)");
	  console.log("Going to Microsoft Edge (Chromium) Slide");
   	xplain.play(4); 
  }
  else if (result.parsedResult.browser.name === "Microsoft Edge" && result.parsedResult.engine.name === "EdgeHTML" ) 
  {
   	//document.write("Microsoft Edge");
   	console.log("Going to Microsoft Edge Slide");
   	xplain.play(7); 
  }
  else if (result.parsedResult.browser.name === "Chrome" )
  {
	  //document.write("Google Chrome");
		console.log("Going to Google Chrome Slide");  
	  xplain.play(1);  
  } 
  else if (result.parsedResult.browser.name === "Internet Explorer") 
  {
    //document.write("Internet Explorer");
    console.log("Going to Internet Explorer Slide");
    xplain.play(10); 
  } 
  else if (result.parsedResult.browser.name === "Firefox") 
  {
    //document.write("Firefox");
    console.log("Going to Firefox Slide");
    xplain.play(13); 
  } 
  else 
  {
    //document.write("Other - " + "Browser Name: " + result.parsedResult.browser.name + " - Engine Name: " + result.parsedResult.engine.name);
    console.log("Going to Manual Selection Slide");
    xplain.play(14);
  }

Simon_Dismore
Posts: 171
Joined: Thu Jul 13, 2017 2:57 pm

Re: Show different image / animation depending on what browser being used?

Unread post by Simon_Dismore » Fri Jun 26, 2020 7:44 am

Darren Rose wrote:
Thu Jun 25, 2020 1:37 pm
to go to a specified slide and then play that slide and next slide(s) then you need ... "xplain.play(3);"
Did you work that out from reverse engineering the output? The documentation for xplain.play() says "This takes no parameters."

User avatar
Tim Green
Site Admin
Posts: 21690
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Show different image / animation depending on what browser being used?

Unread post by Tim Green » Fri Jun 26, 2020 11:30 am

Simon_Dismore wrote:
Fri Jun 26, 2020 7:44 am
Did you work that out from reverse engineering the output? The documentation for xplain.play() says "This takes no parameters."
That was the information I had when I originally wrote the documentation. New information from Alexander is now that this can be used and is actually needed if you also want to play. An xplain.goto(slide) followed by an xplain.play() won't work because the methods are asynchronous. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.

Simon_Dismore
Posts: 171
Joined: Thu Jul 13, 2017 2:57 pm

Re: Show different image / animation depending on what browser being used?

Unread post by Simon_Dismore » Fri Jun 26, 2020 2:07 pm

Tim Green wrote:
Fri Jun 26, 2020 11:30 am
Simon_Dismore wrote:
Fri Jun 26, 2020 7:44 am
Did you work that out from reverse engineering the output? The documentation for xplain.play() says "This takes no parameters."
That was the information I had when I originally wrote the documentation. New information from Alexander is now that this can be used and is actually needed if you also want to play. An xplain.goto(slide) followed by an xplain.play() won't work because the methods are asynchronous. :?
Thanks, that's a classic example of an API evolving without the docs being updated. Would it make sense to ship uncompressed versions of the HelpXplain js files along with the product? A write-up of the XML might be useful, too.
Last edited by Simon_Dismore on Sat Jun 27, 2020 9:21 am, edited 1 time in total.

User avatar
Tim Green
Site Admin
Posts: 21690
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Show different image / animation depending on what browser being used?

Unread post by Tim Green » Fri Jun 26, 2020 3:05 pm

Hi Simon,
Simon_Dismore wrote:
Fri Jun 26, 2020 2:07 pm
Would it make sense to ship uncompressed versions of the HelpXplain js files along with the product?
They're already there, in a subfolder of the HelpXplain program directory. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.

Simon_Dismore
Posts: 171
Joined: Thu Jul 13, 2017 2:57 pm

Re: Show different image / animation depending on what browser being used?

Unread post by Simon_Dismore » Fri Jun 26, 2020 4:45 pm

Tim Green wrote:
Fri Jun 26, 2020 3:05 pm
Hi Simon,
Simon_Dismore wrote:
Fri Jun 26, 2020 2:07 pm
Would it make sense to ship uncompressed versions of the HelpXplain js files along with the product?
They're already there, in a subfolder of the HelpXplain program directory. 8)
Sorry, I meant not minimised.
[screenshot] xplain.js.png
You do not have the required permissions to view the files attached to this post.

User avatar
Tim Green
Site Admin
Posts: 21690
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Show different image / animation depending on what browser being used?

Unread post by Tim Green » Sat Jun 27, 2020 6:07 am

Hi Simon,

Sorry, I didn't check that and wasn't aware that Alex is now minimizing those files. I'll look into it. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.

Post Reply