The other day a consultant asked how you can link to external documents from an Xcelsius HTML5 dashboard.  Previously with flash you can add a URL link to the document path, but in HTML it isn't always as simple, unless you know the absolute URL to link to.  The following steps shows how to link to a word document that I've saved along with the dCoded dashboard.

Step by Step


  1. Add a URL button to your dashboard
  2. Give the button the URL of “**DOCUMENT**”  this is a placeholder so we can find it in the code later
  3. dCode the dashboard
  4. Place the word document in the root of the dashboard (ie in the same place as the app.html file)  In my example I will use the document called test.docx
  5. Open up the javascript file called components_1.js found in the gen_GUIDfolder
  6. paste the following code at the very top of that file
    function replaceAll(str,find,replace){return str.replace(new RegExp(find,'g'),replace);}
    var split=window.location.href.split('/');var pop=split.pop();var joined=split.join();var url=replaceAll(joined,',','/');
  7. Search through the rest of the file for the placeholder “**DOCUMENT**”
  8. replace the placeholder (including the ” ) with

    Change the file name as appropriate

  9. In my example the code now looks like this:
  10. Now when you click on the URL button it will open / download the word document




Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>