Search code examples
gooddata

GoodData: How to make the Dashboard Macros work in Firefox?


I can embed content from my app to GoodData dashboard using "Web content". Dashboard macros are a way how to have the content customized depending on the dashboards it appears in - some reference: http://developer.gooddata.com/article/how-to-use-dashboard-macros

http://developer.gooddata.com/article/dashboard-macro-reference

I'm trying to embed content on a link like this:

http://myserver.com/apps/my_app#%CURRENT_DASHBOARD_URI%/%CURRENT_DASHBOARD_TAB_URI%

It works fine in Chrome, but it does weird things in Firefox. Seems like I'm the macros don't work - the %CURRENT_DASHBOARD_URI% isn't being replaced with a tring like %2Fgdc%2Fmd%2FGoodSalesDemo%2Fobj%2F1952 as suggested in the docs


Solution

  • In fact macros work in Firefox, the issue is just the way Firefox works with decoding URLs. Chrome doesn't decode the string dashboard URI for you and therefore you get:

    http://myserver.com/apps/my_app#%2Fgdc%2Fmd%2FGoodSalesDemo%2Fobj%2F1952/85f6945b672d
    

    Firefox does the decoding for you and you get

    http://myserver.com/apps/my_app#/gdc/md/GoodSalesDemo/obj/1952/85f6945b672d
    

    Therefore slash isn't a good character to separate %CURRENT_DASHBOARD_URI% and %CURRENT_DASHBOARD_TAB_URI% in your app.

    Also when parsing the parameters out of the URL, you have to make sure that it's decoded - e.g. the decodeURIComponent function in JavaScript. decoding won't hurt the already decoded string in Firefox and will decode the string in Chrome.