KB113: Using the GetURL action with AIML

One application of AIML chatbots is to let a character help guide a user through a website. Since the AIML template portion of a rule can contain any character actions, the easiest way to do this is to use a <geturl/> action.

This sample shows a few variations on the <geturl/> action.

The template portion of an AI rule might read:

Ok, I will replace my page with a new one. <geturl url="'ReplacePage.html'"/>

Without a target, the new page replaces the page with the flash file. The new page might also have a Character Builder project, possibly even the same project. In the FRAME rule we add as target the name of a second frame beside the character:

Ok, I will bring up a page <lookleft/> in this frame. <pause/> <geturl url="'FramePage.html'" target="'mainframe'"/>

If you specify '_blank' as a target then it is assumed to be a secondary window.

Ok, I will open a secondary window for you. <geturl url="'SecondaryPage.html'" target="'_blank'"/>

Popup windows require that your user enable popups in their browser. To get full control over the popup window you can trigger a javascript event in the containing page, as follows:

Ok, I will popup another window for you. <geturl url="'javascript:doPopup()'"/>

Then, in the containing page, you can use a block of script such as:

<script type="text/javascript"> function doPopup() { win = window.open('PopupPage.html',null,'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,width=400,height=275,top=100,left=100'); win.focus(); } </script>

Copyright © 2016 Media Semantics, Inc. All rights reserved.
Comments? Write webmaster@mediasemantics.com. See also our privacy policy.

Image 01