7

First off... I don't really want to use iframes but I don't think I have a choice in this situation.

I'm integrating some help docs into an already built system. The easiest thing for me to let other people write the help is to provide them with a mediawiki with a custom style, then to integrate this into the system I wanted to put a direct link to the mediawiki in a help tab.

The problem is, my mediawiki appears to block iframes from loading it (maybe this is a default setting) but I was wondering how to turn it off. I know my code is fine as it loads other sites!

Also can you do what I'm attempting to do with a div tag?

Thanks

ingh.am
  • 25,981
  • 43
  • 130
  • 177
  • The wiki doesn't allow you to. Take a look at: http://stackoverflow.com/questions/1321497/prevent-kill-frame – Yisela Dec 02 '11 at 16:01
  • I've seen this. Can you not set it to allow you too? I can load the actual mediawiki site and even wikipedia in my iframe! Just not my install of mediawiki... – ingh.am Dec 02 '11 at 16:33
  • How about this: http://www.developpez.net/forums/d274641/webmasters-developpement-web/html-dhtml-xhtml/wiki-iframe/ (it's in french but google translates it perfectly). It says "find the file "mediawiki-1.xx \ skins \ common \ wikibits.js - and comment out these two lines: A-trap us from framesets --- if (window.top! = window) --- window.top.location = window.location; --- if it works we can post it for future reference – Yisela Dec 02 '11 at 16:39
  • Thanks, that looks like what I want. I'll try it in a min and report back! – ingh.am Dec 03 '11 at 18:21
  • That seems to work thanks, do you want to put an answer in the question and I'll accept it... :) – ingh.am Dec 05 '11 at 21:34

2 Answers2

9

The wiki doesn't normally allow you to do it, but there is a workaround:

To display the wiki in an iframe, you have to find the file "mediawiki-1.xx \ skins \ common \ wikibits.js "and comment out these two lines:

/ / A-trap us from framesets
if (window.top! = window)
window.top.location = window.location;

This is the code that doesn't allow the wiki to show. Seen in here.

Yisela
  • 6,909
  • 5
  • 28
  • 51
5

This is a configuration option and can be set in LocalSettings.php.
See $wgEditPageFrameOptions and $wgBreakFrames.

Be aware that this can open you up to certain "click-jacking" attacks.

Mark Hall
  • 53,938
  • 9
  • 94
  • 111
bawolff
  • 51
  • 1
  • Yea, I think setting this to false actually does the same thing as above. – ingh.am Dec 07 '11 at 22:28
  • 1
    No it doesn't (or won't on modern versions). MediaWiki also sends some HTTP headers to prevent framing which editing the js by hand won't get rid of (Also manually editing js files often gets overriden during upgrade, people forget what they modified, where config settings aren't usually overriden) – bawolff Jan 02 '12 at 02:15
  • Sorry, i should say sends HTTP headers for some pages (only on pages where you can submit a form that would change the state of the wiki), which can include some pages you wouldn't expect it to (for example diffs if patrolling is enabled). Viewing normal pages probably won't trigger the http header, but other pages will (edit pages being a prime example). – bawolff Jan 02 '12 at 11:58