Embed a poll with an iframe
Use the iframe code to place a PHPPoll poll on any page that allows iframes. Learn the URL parameters for theme and accent color and how to set the height.
An iframe is the classic way to show content from another address. It needs no JavaScript on your page and works almost everywhere.
The code
<iframe src="https://www.example.com/poll/embed.php?id=POLL_ID"
width="100%" height="520" style="border:0;max-width:600px"
loading="lazy" title="Poll"></iframe>
Copy it from Embed & share → iFrame. The code already contains the correct poll ID and web address.
URL parameters
| Parameter | Example | Effect |
|---|---|---|
id | id=abc123 | The poll to show (required). |
theme | theme=dark | light, dark or auto. |
accent | accent=e11d48 | Accent color without the #. |
https://www.example.com/poll/embed.php?id=abc123&theme=dark&accent=e11d48
Choosing the height
A plain iframe has a fixed height. Pick a height that fits the results with the most options, usually 450–650 pixels for choice polls and 400 pixels for ratings. If the content is higher, a scrollbar appears inside the frame. To avoid fixed heights altogether, use the JavaScript embed, which resizes automatically.
Transparent background
The page inside the frame is transparent. Only the poll card itself is drawn, so the poll blends with your page background.
Allowed everywhere
The embed page sends headers that allow it to be framed on any website, which is what you need for embedding. The admin panel, in contrast, can only be framed by your own site.
Votes from iframes are counted with the source domain of the page that contains the frame, and the vote limit also works inside iframes. See Prevent duplicate votes and spam.
Last updated