没有包装器的iframe维基百科文章 [英] iframe wikipedia article without the wrapper
问题描述
我想在一个页面中嵌入一个维基百科文章,但我不希望文章中包含所有包装(导航等)。我在这里看到了它: http://www.dayah.com/periodic/ 。单击元素并显示iframe并仅链接到文章(无包装器)。那他们怎么做到的呢?看起来像JavaScript句柄显示iframe并构建href但是在浏览页面之后javascript( http: //www.dayah.com/periodic/Script/interactivity.js )我仍然无法弄清楚网址是如何构建的。谢谢。
I want to embed a wikipedia article into a page but I don't want all the wrapper (navigation, etc.) that sits around the articles. I saw it done here: http://www.dayah.com/periodic/. Click on an element and the iframe is displayed and links to the article only (no wrapper). So how'd they do that? Seems like JavaScript handles showing the iframe and constructing the href but after browsing the pages javascript (http://www.dayah.com/periodic/Script/interactivity.js) I still can't figure out how the url is built. Thanks.
推荐答案
周期表示例将打印机友好版本的wiki artice加载到iframe中。 http://en.wikipedia.org/wiki/Potasium ? printable = yes
The periodic table example loads the printer-friendly version of the wiki artice into an iframe. http://en.wikipedia.org/wiki/Potasium?printable=yes
它在函数click_wiki(e)(第534行,interactivity.js)中完成
it's done in function click_wiki(e) (line 534, interactivity.js)
var article = el.childNodes[0].childNodes[n_name].innerHTML;
...
window.frames["WikiFrame"].location.replace("http://" + language + ".wikipedia.org/w/index.php?title=" + encodeURIComponent(article) + "&printable=yes");
这篇关于没有包装器的iframe维基百科文章的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!