URL Parameter

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

Moderators: Alexander Halser, Tim Green

Post Reply
Terry McMorrow
Posts: 14
Joined: Tue Jul 23, 2019 2:22 am

URL Parameter

Unread post by Terry McMorrow »

I would like to keep track of which employees have taken the created Tutorial (xPlain)

I would like to pass the parameter in the url
something like
example.html/?empno=12345

I would capture the empno in the xplain, possible pass it to chained explains. Finally when completed I will send an API to update database

Has anyone attempted this yet?

Thank you for any help you can give me on this!
Terry McMorrow
Posts: 14
Joined: Tue Jul 23, 2019 2:22 am

Re: URL Parameter

Unread post by Terry McMorrow »

Figured out how to get url parameter - Here is how to do it in case you are trying to do it

in custom scripts --
//*** Got this function from https://css-tricks.com/snippets/javascr ... variables/ ***
function getQuery(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}

on a slide put a textbox - rename it text1 and put text like "Empno"

for text1 goto Link & Interaction -> Execute Script (radio button)
enter -> xplain.set("#text1", {innerHTML:getQuery("empno")}, 0);

when you click text1 you will get "undefined" in text1 (we have not defined empno yet)

Publish and open in browser - add -> ?empno=12345 <- to end of url (then refresh)
example: N:/HelpExplain/GetEmpno.html?empno=12345

now when you hit text1 empno 12345 will show up

notice that xplain.set allows you to put Java Function in it! Pretty cool
User avatar
Tim Green
Site Admin
Posts: 23153
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: URL Parameter

Unread post by Tim Green »

Hi Terry,

Nice. I haven't tested out your regex in detail, but you need to make sure that only valid data can get through, to protect yourself against cross-site scripting attacks. :)
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