Html(embed) code opening in new window/tab

By Helmut_pdorf Helmut_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 Foster Timothy 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

Sorted-ListPages-List - 06 Jun 2021 03:46
Todo List with Data Forms - 30 Apr 2015 14:59
Facebook Button - 27 Dec 2013 15:03
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: +2
What kind of links work
Doctor Seven Doctor Seven 29 Mar 2022 14:09

I tried this and only changed the reddit link to this page's url, and it didn't work.

by Doctor Seven Doctor Seven , 29 Mar 2022 14:09
page revision: 1, last edited: 29 Oct 2014 09:05
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).

AltStyle によって変換されたページ (->オリジナル) /