Skip to content Skip to sidebar Skip to footer

Embed A UserVoice Widget In An Add-in In Excel For Windows

(* I clean up the initial thread *) I want to add the UserVoice widget to one Excel add-in. I have made the following example code:

Solution 1:

In terms of loading-speed, could you load the UserVoice dynamically, i.e., using jQuery.getScript(...)?

For #2, what were you expecting?


Solution 2:

Here's a complete working page:

<!DOCTYPE html>
<html>
<head>
    <title>UserVoice test</title>
    <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/Office.js" type="text/javascript"></script>
</head>
<body>
    <div id="contact_us">Contact us</div>
</body>
<script>
    UserVoice=window.UserVoice||[];(function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/KIXLyRfZDu6MdnaaVtnlSw.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})();
    UserVoice.push(['set', {
        width:'300px',
        post_suggestion_enabled:true
    }]);
    UserVoice.push(['identify', {}]);
    UserVoice.push(['addTrigger', '#contact_us', { mode: 'contact',menu_enabled:true, }]);
</script>
</html>

Some things I changed include:

  • Changed the #contact_us element to be a div instead of a link.
  • Removed your extra tag
  • Added the optional parameters in the addTrigger call
  • Added identify and set statements

Also, make sure your environment is in a good state:

  • Clear your browser cache to ensure that old code isn't present during debugging: open Internet Explorer (not Edge) and select Safety > Delete Browsing History > Select all boxes > Delete > close all IE windows and all Office windows.
  • Host the code online

Post a Comment for "Embed A UserVoice Widget In An Add-in In Excel For Windows"