iframe 標籤筆記:硬體設定

2025/04/10

Categories: HTML Tags: iframe

前言

在把 https://gtisland.com/tunerR1 網頁嵌入到 wordpress 網站時,瀏覽器能夠成功調用麥克風,而 Hugo 網站卻不行。

在 Wordpress 可以,但 Hugo 不行的嵌入碼:

<iframe src="https://gtisland.com/tunerR1"
width="100%"
height="auto"
style="border:none; display:block; min-height: 690px;">
</iframe>

硬體權限要另外開

只要把程式碼加入「allow=“microphone”」即可

<iframe 
  src="https://gtisland.com/tunerR1" 
  width="100%" 
  height="auto" 
  style="border:none; display:block; min-height: 690px;" 
  allow="microphone"><!--加入這行 -->
</iframe>

如果程式還要用到相機、地理位置,可以再加上:

<iframe 
allow="microphone; camera; geolocation">

爲何 Wordpress 不用加?

因爲 Wordpress 較上層的父頁面已經同意過了,所以在各個文章或頁面當中不用再加。

>> Home