All Categories Quick Guides Automatically open widget

Automatically open widget

Some examples

By Stefan Dreßler
November 12, 2021

Sometimes you my want to open the HelpSpace widget immediately after your website was loaded. Please make sure to add your widget first. How to add a Widget to my self-service site

General wrapper for all following examples

These lines tell the browser to wait until the page DOM is loaded.

// widget snippet script
<script
  id="helpspace-widget-script"
  ...
></script>


// additional script
<script>
   window.addEventListener("load", function() {

      // insert one of the following examples here
      ...

   });
</script>

Open widget on any page

...

      HelpWidget('open');

...

Open widget and go to docs

...

      HelpWidget('open', { docs: true } );

...

Open widget on a specific page

If you add the script global on your website, but you want to open the widget on some pages only, please customize this example for your needs.

...

   if(!["/category/page1", "/some-page"].includes(window.location.pathname)) 
   {
      HelpWidget('open');
   }

...

For more features please have a look at our Widget Javascript API.

Was this article helpful?