iframe embed

By James KanjoJames Kanjo

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

Description

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:

[!--
[[code]]

[x] code goes here

[[/code]]
--]

[[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.

Code

In action

[[embed]]
<iframe class="" style="" frameborder="0" width="100%" height="300px" align="" scrolling="auto" src="http://snippets.wdfiles.com/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>
[[/embed]]

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

Extended NewPage Module - 15 Jul 2014 15:08
Specific Users Only Include - 24 Jul 2013 06:16
iframe Redirect - 30 Jul 2012 22:41
Per Category CSS Module - 06 Mar 2012 03:38
Video Player - 16 Feb 2012 01:50
Remove Duplications - 16 Feb 2012 01:39
RegExp Date Wizard - 16 Feb 2012 01:39
"Random Page!" link - 16 Feb 2012 01:35
Quoted Blockquotes - 16 Feb 2012 01:33
NewPage Button - 16 Feb 2012 01:26
MP3 Player - 16 Feb 2012 01:25
JavaScript Addition - 16 Feb 2012 01:14
Random Page - 18 May 2011 09:50
Redirect - 11 Feb 2010 10:00


Rate this solution

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

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