iframe embed

By James KanjoJames Kanjo

WARNING: This snippet has become redundant since the creation of the HTML Block on the 2/March/2010


Throughout the whole of Wikidot, people are putting HTML code into code-blocks, and then iframing the Wikidot-generated HTML page.

Iframing HTML gives a result somewhat like embedding the HTML in the Wikidot page, but is secure. Whereas embedded code comes from the same domain as the page, and can thus use (steal or abuse) security cookies or resources, iframed code comes from a different domain (wdfiles.com) and thus has no access to the wikidot.com resources.

Just about every single day on the Wikidot community forums, we get somebody asking how to embed [x] code on [y] page. And every time we tell them:


[x] code goes here


[[iframe /local--code/THIS_PAGE'S_NAME]]

This becomes problematic when they try to “embed” a set of HTML code on the one page, at which point we need to tell them to append /1 or /x to the iframe URL, depending on the index of the code.

This is information that they don't really understand, and nor should they need to. So I devised this new special code that will iframe any embed code automatically.


In action

<iframe class="" style="" frameborder="0" width="100%" height="300px" align="" scrolling="auto" src="https://files.snippets.obscurative.ru/local--code/code:iframe-embed#%3Cscript%20src%3D%22http%3A//gmodules.com/ig/ifr%3Furl%3Dhttp%3A//www.google.com/ig/modules/datetime.xml%26up_color%3Dred%26synd%3Dopen%26w%3D320%26h%3D136%26title%3DDate+%2526+Time%26border%3D%2523ffffff%257C3px%252C1px+solid+%2523999999%26output%3Djs%22%3E%3C/script%3E%20"></iframe>

Thanks to tsangk for this great snippet: conditional-blocks

text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]

Other snippets posted by James Kanjo

Rate this solution

If you think this solution is useful — rate it up!

rating: +13+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License