12-15-2023 01:54 PM
I am looking to pass a variable from the STORE Data Provider as part of an iFrame URL. For example:
"widgets": {
"comp1": {
"attributes": {
"src": "https://test/{$STORE.agent.agentId}"
},
"comp": "agentx-wc-iframe"
}
}
The value is not being passed, rather the literal string that I put in. Any ideas?
Solved! Go to Solution.
12-19-2023 04:21 AM
04-17-2024 07:02 AM
I tried above shared code but with my url , buts its not working , is there any other method to get user details in iframe page.
12-19-2023 04:21 AM
12-19-2023 02:30 PM
Thank you for this, it was super helpful to put me on the right track. I wanted to make it work just how you had it before trying to modify it for my use case. I am just getting a grey screen in my WxCC NAV panel.
{
"nav": {
"align": "top",
"icon": "share-screen",
"iconType": "momentum",
"label": "Test IFrame",
"navigateTo": "test-iframe-2"
},
"page": {
"id": "test-iframe-2",
"layout": {
"areas": [
[
"comp1"
]
],
"size": {
"cols": [
1
],
"rows": [
1
]
}
},
"widgets": {
"comp1": {
"attributes": {
"parameter": "$STORE.agent.agentId"
},
"comp": "widget-one",
"script": "https://<redacted>/iframe.js"
}
}
},
"visibility": "SCREEN_POP"
}
class IframeComponent extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.render();
}
get paramater() {
return this.getAttribute('paramater');
}
set paramater(val) {
if (val) {
this.setAttribute('paramater', val);
} else {
this.removeAttribute('paramater');
}
}
render() {
this.shadowRoot.innerHTML = `
<style>
iframe {
width: 100%;
height: 100%;
border: none;
}
</style>
<iframe src="https://www.javascripttutorial.net/${this.paramater}"></iframe>
`;
}
}
if (!customElements.get('iframe-component')) {
customElements.define('iframe-component', IframeComponent);
}
04-17-2024 06:49 AM
I tried above shared code but with my url , buts its not working , is there any other method to get user details in iframe page.
12-15-2023 04:05 PM
12-15-2023 05:10 PM
Thanks....I wish I knew what that all meant. Remember this is a "agentx-wc-iframe" so I'm just loading a URL in the page. I don't exactly know what you mean by all of this. Could you share a complete json widget example?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide