cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
149
Views
1
Helpful
1
Replies

CCX gadget relative addressing for CSS

Occipital
Level 1
Level 1

I'm deploying to a topology that requires using 3rdpartygadget to publish gadgets, and although the addresses for script resources can be relative, the CSS appears to require fully-qualified URLs using

 

__UP_externalServerHost__/3rdpartygadget/files

 

However, this introduces variability and high potential for mistakes because the product folder must be included in that path. This essentially precludes using versioned folders for documentation and cache-busting on upgrades.

Sure, one can hope the developer remembers to scour the entire project for correct paths, but 10 times out of 10 this is overlooked until, at the customer site, one has to explain why the gadget looks like crap.

Attempting to use normal relative addresses (exactly as how the `<script>` tags do) makes the browser look for CSS resources on `https://localhost_8082/...`.

Has anyone found a viable workaround for this bug?

Thanks! 

1 Reply 1

Here is a code snippet that I use in the gadget init function to get gadget URL. Then I write down as a gadget internal variable that I can use in its code.

// Get gadget URL
			_log('get gadget url');
			_gadgetURL = $('#finesse_gadget_' + finesse.containerservices.ContainerServices.getMyGadgetId(), window.top.document).attr('src');
			_gadgetURL = finesse.utilities.Utilities.getParameterByName(_gadgetURL, 'url');
			_gadgetURL = _gadgetURL.substring(0, _gadgetURL.lastIndexOf('/')+1);
			_gadgetURL = _gadgetURL.substring(_gadgetURL.indexOf(finesse.utilities.Utilities.extractHostname(_gadgetURL)));
			_gadgetURL = _gadgetURL.substring(_gadgetURL.indexOf('/'));
			_log('gadget url: ' + _gadgetURL);

 

Marek https://gaman-gt.com
UCCE, PCCE, UCCX, WxCC, Cisco Finesse, Custom Gadget, CVP, CUIC, CUCM