[DOCS]: Passing inputs to the Embedded App (Using the <iframe> Tag) #253

Closed
opened 2026-02-16 05:19:36 -05:00 by yindo · 1 comment
Owner

Originally created by @rlaisw on GitHub (Oct 22, 2025).

Type of Documentation Change

Error/Typo fix

Documentation Page URL or Path

https://docs.dify.ai/en/guides/application-publishing/embedding-in-websites#using-the-%3Ciframe%3E-tag-2

Current Content

I already setup a self hosted Dify on Linux and setup a sub directory "static" on Dify host server for saving html files for nginx proxy, i want to pass a user's email address to a chatflow app, like : http://10.161.121.22/static/example6.html?user_email=test@abc.com
i can open the chatflow app in my web browser and verified the email address able to pass to the browser through the below javascript

But chatflow cannot read the user's email {{user_email}} variable

<html lang="en"> <head> <style> html,body{height:100%;margin:0;font-family:Arial,Helvetica,sans-serif} #hdr{background:#1c64f2;color:#fff;padding:.6rem 1rem;font-size:1rem} iframe{width:100%;height:calc(100% - 2.5rem);border:0} </style> </head>
Welcome, !
<script src="https://cdn.jsdelivr.net/npm/pako@2/dist/pako.min.js"></script> <script> /* 2. grab the e-mail from the page URL (or fall back) */ const userEmail = new URLSearchParams(location.search).get('user_email') || 'guest@example.com'; /* 3. show it in the banner */ document.getElementById('user_email').textContent = userEmail; /* 4. build the encoded "name" parameter that Dify expects */ const inputs = { user_email: userEmail }; // add more keys if you wish function pack(obj){ const gz = pako.gzip(JSON.stringify(obj)); // gzip const b64 = btoa(String.fromCharCode(...gz)); // base64 return encodeURIComponent(b64); // url-encode } /* 5. create the iframe src */ const src = `http://10.161.121.22/chatbot/qS96n3Fi9UZfdHNh?user_email=${pack(inputs)}`; /* 6. inject the iframe */ document.write(``); </script> </html>

Suggested Changes

provide a solution to fix my problem and show me how to setup in Dify

Reason for Change

No response

Code of Conduct

  • I agree to follow Dify's documentation contribution guidelines
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.
Originally created by @rlaisw on GitHub (Oct 22, 2025). ### Type of Documentation Change Error/Typo fix ### Documentation Page URL or Path https://docs.dify.ai/en/guides/application-publishing/embedding-in-websites#using-the-%3Ciframe%3E-tag-2 ### Current Content I already setup a self hosted Dify on Linux and setup a sub directory "static" on Dify host server for saving html files for nginx proxy, i want to pass a user's email address to a chatflow app, like : http://10.161.121.22/static/example6.html?user_email=test@abc.com i can open the chatflow app in my web browser and verified the email address able to pass to the browser through the below javascript But chatflow cannot read the user's email {{user_email}} variable <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Dify Chatbot – full dashboard</title> <style> html,body{height:100%;margin:0;font-family:Arial,Helvetica,sans-serif} #hdr{background:#1c64f2;color:#fff;padding:.6rem 1rem;font-size:1rem} iframe{width:100%;height:calc(100% - 2.5rem);border:0} </style> </head> <body> <div id="hdr">Welcome, <span id="user_email"></span>!</div> <!-- 1. pako library for gzip --> <script src="https://cdn.jsdelivr.net/npm/pako@2/dist/pako.min.js"></script> <script> /* 2. grab the e-mail from the page URL (or fall back) */ const userEmail = new URLSearchParams(location.search).get('user_email') || 'guest@example.com'; /* 3. show it in the banner */ document.getElementById('user_email').textContent = userEmail; /* 4. build the encoded "name" parameter that Dify expects */ const inputs = { user_email: userEmail }; // add more keys if you wish function pack(obj){ const gz = pako.gzip(JSON.stringify(obj)); // gzip const b64 = btoa(String.fromCharCode(...gz)); // base64 return encodeURIComponent(b64); // url-encode } /* 5. create the iframe src */ const src = `http://10.161.121.22/chatbot/qS96n3Fi9UZfdHNh?user_email=${pack(inputs)}`; /* 6. inject the iframe */ document.write(`<iframe src="${src}" allow="microphone"></iframe>`); </script> </body> </html> ### Suggested Changes provide a solution to fix my problem and show me how to setup in Dify ### Reason for Change _No response_ ### Code of Conduct - [x] I agree to follow Dify's documentation [contribution guidelines](https://github.com/langgenius/dify/blob/0277a37fcad5ad86aeb239485c27fffd5cd90043/CONTRIBUTING.md) - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields.
yindo added the documentationbug labels 2026-02-16 05:19:36 -05:00
yindo closed this issue 2026-02-16 05:19:36 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 2, 2025):

Hi, @rlaisw. I'm Dosu, and I'm helping the dify-docs team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported an issue with passing the {{user_email}} variable to a Dify chatflow app embedded via iframe.
  • Your JavaScript extracts and encodes the email, but the chatflow app does not receive the variable as expected.
  • The problem seems related to a documentation error or typo about embedding and passing inputs through the iframe tag.
  • There has been no further activity or comments on this issue since your initial report.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of the dify-docs repository by commenting here.
  • If I do not hear back within 5 days, this issue will be automatically closed.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Nov 2, 2025): Hi, @rlaisw. I'm [Dosu](https://dosu.dev), and I'm helping the dify-docs team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported an issue with passing the `{{user_email}}` variable to a Dify chatflow app embedded via iframe. - Your JavaScript extracts and encodes the email, but the chatflow app does not receive the variable as expected. - The problem seems related to a documentation error or typo about embedding and passing inputs through the iframe tag. - There has been no further activity or comments on this issue since your initial report. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of the dify-docs repository by commenting here. - If I do not hear back within 5 days, this issue will be automatically closed. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-docs#253