fix: prevent Chrome mobile permission prompts on embedded chat widget#35374
Open
DanKunleLove wants to merge 1 commit intolanggenius:mainfrom
Open
fix: prevent Chrome mobile permission prompts on embedded chat widget#35374DanKunleLove wants to merge 1 commit intolanggenius:mainfrom
DanKunleLove wants to merge 1 commit intolanggenius:mainfrom
Conversation
The embedded chatbot iframe unconditionally requested `microphone`
permission via `iframe.allow = "fullscreen;microphone"`, which triggers
Chrome mobile to show a permission prompt before rendering the widget —
even when the chat app doesn't use audio input.
Changes:
- Make `microphone` permission opt-in via `enableMicrophone` config flag
in difyChatbotConfig (defaults to off)
- Fix `allow` attribute syntax to use proper space-separated format
per the Permissions Policy spec (`"fullscreen; microphone"`)
- Update iframe embed example to only request `fullscreen` by default
- Update both embed.js and embed.min.js
Users who need microphone access can enable it:
```js
window.difyChatbotConfig = {
token: 'your-token',
enableMicrophone: true
}
```
Fixes langgenius#35330
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #35330 — the embedded chatbot bubble widget triggers Chrome mobile permission prompts ("access to apps and services") instead of rendering, because the iframe unconditionally requests
microphonepermission.Root cause
web/public/embed.jsline 159:On Chrome mobile, requesting
microphonein the iframeallowattribute triggers a browser permission prompt even when the chat doesn't use audio input. This blocks the widget from rendering until the user grants permission.Changes
microphonepermission opt-in viaenableMicrophoneconfig flag indifyChatbotConfig(defaults tofalse)allowattribute syntax — use space-separated format per the Permissions Policy spec ("fullscreen; microphone"not"fullscreen;microphone")fullscreenby defaultembed.jsandembed.min.jsUsage
Users who need microphone access (e.g., for voice input) can opt in:
Test plan
enableMicrophone— verify no permission prompt on Chrome mobileenableMicrophone: true— verify microphone permission works when neededFixes #35330