Html(embed) code opening in new window/tab

By Helmut_pdorfHelmut_pdorf

Description

With "html" command ( embed a foreign code) on a page you can insert near all scripts from external suppliers in your wiki-page ( see also snippet Use any html code on a page ).

The problem: sometimes you need the embbeded script called in your page that it is "opening in a new tab/window "

Thanks to Timothy FosterTimothy Foster !
There is an information from him on the community forum Thread Html & New Windows which is very clever solving this problem.
I have copied his post here for better understanding:

Code

Currently your iframe looks like this:

[[html]]
<script src="http://www.reddit.com/r/karate/top/.embed?limit=5&t=month" type="text/javascript">

</script>
[[/html]]

Change it to this:

[[html]]
<base target="_blank" />
<script src="http://www.reddit.com/r/karate/top/.embed?limit=5&t=month" type="text/javascript"></script>
[[/html]]

Source info: http://stackoverflow.com/questions/1037839/how-to-force-link-from-iframe-to-be-opened-in-the-parent-window
Test Page: http://tarm.wikidot.com/iframe-newwindowall

the little line @base target="_blank" /@ makes the trick…!

In action

Test Page: http://tarm.wikidot.com/iframe-newwindowall

Thanks Timothy!


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 Helmut_pdorf

Todo List with Data Forms - 30 Apr 2015 14:59
Facebook Button - 27 Dec 2013 15:03
Sorted-ListPages-List - 19 Aug 2013 15:56
Advanced Search - 25 Feb 2012 12:29
Top Nav Menu with ListPages - 16 Feb 2012 01:48
Schedules - 16 Feb 2012 01:40
Use any html code on a page - 16 Feb 2012 01:34
Find untagged pages - 15 Feb 2012 00:52


Rate this solution

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

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