iframe wikipedia article without the wrapper

让人想犯罪 __ 提交于 2019-12-06 05:36:58

The periodic table example loads the printer-friendly version of the wiki artice into an iframe. http://en.wikipedia.org/wiki/Potasium?printable=yes

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");

@VolkerK is right, they are using the printable version.

Here is an easy way to find out when you know the site is displaying the page in an iframe.

In Firefox right click anywhere inside the iframe, from the context menu select "This Frame" then "View frame info"

You get the info you need including the Address:

Address: http://en.wikipedia.org/w/index.php?title=Chromium&printable=yes

The jQuery library lets you specify part of a page to retrieve by an Ajax call, with a CSS-like syntax: http://docs.jquery.com/Ajax/load

You could always download the site and scrap it. I think everything inside <div id="bodyContent"> is the content of the article - sans navigation, header, footer, etc..

Don't forget to credit. ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!