A.6 Common iframe errors
If you followed steps in Chapter 10: Embed on the Web and the contents of your iframe still do not appear in your browser, check for these common problems:
Items listed in your iframe (such as the URL, width, or height) should be enclosed inside straight single-quote (
', also known as an apostrophe) or double-quote marks (
", also known as quotation marks). Choose either type, but be consistent.
Always use straight quote marks, and avoid accidentally entering curly quotes (also known as smart quotes or slanted quotes), which sometimes happens when pasting code from word-processor tools.
https(the extra ‘s’ means ‘secure’), not
httpin iframes. Some web browsers will block content if it mixes https and http resources. All of the code templates in this book require https.
Use the W3Schools TryIt iframe page to test your iframe embed codes, especially when you need to edit them, since it’s a great way to check for mistaken punctuation. Figure A.5 shows three common problems in a simple iframe: a curly double-quote (after
src=), use of
http instead of
https, and mixture of double-quotes and single-quotes. All of these problems are corrected in Figure A.6, which causes the iframe to appear as expected.