Recent searches


No recent searches

How to load a template in a modal



Posted Dec 15, 2021

I using the instances.create action, something like this:

client.invoke('instances.create', {  location: 'modal',

url: 'https://en.m.wikipedia.org/wiki/Main_Page',

  size: { // optional

    width: '450px',

    height: '300px'

  }

However rather than passing in a url, I would like to pass html, coz I generate a template using a schema that comes to me via an api call. 
I tried converting my html to a blob and then generate a url using URL.createObjectURL() method on that blob, however when my modal opens, I am hit by an error 'tried to show an iframe with a location that is neither absolute nor asset'
Is there a way I can get around this ?

 


0

1

1 comment

Hi,

I'm not sure that you'll be able to pass HTML, as Zendesk is trying to open an existing document (whether part of the app files or external HTML) as the modal iframe.

But, you do have an option for passing this data.

You can create a separate HTML document in your app, say modal.html and add it as your modal location in the manifest.

Then you can use the instance reference to pass your data with notification event - 

Send: https://developer.zendesk.com/api-reference/ticketing/apps/apps/#send-notification-to-app

Then you can catch the notification event and its data, using that to create the modal contents - either by passing html (might need to encode) or passing your schema and creating the html content in the js within the modal.

Receive: https://developer.zendesk.com/api-reference/apps/apps-support-api/all_locations/#notification-events

Hope that helps,
Cheryl

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post