I found the snippet below for creating an iframe:
I'd like to only load the textual content at http://www.host.com
and make the iframe invisible using display:none
Background:
I need an effective way to parse out the favicon location. Not all site have a default location. For example <link rel="SHORTCUT ICON" href="../images/logo_small.ico" />
.
Hence all I need are the textual contents. PHP has a function that does this ( file_get_contents
) but I want to do it on the client side.
Here is the mdn documentation on iframe
For server-side PHP use file_get_contents.
function makeFrame() {
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", "http://www.host.com");
ifrm.style.width = 640+"px";
ifrm.style.height = 480+"px";
document.body.appendChild(ifrm);
}
Example of Delicious Bookmarklet:
javascript:(function()
{
f='http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+
'&title='+encodeURIComponent(document.title)+'¬es='+
encodeURIComponent(''+
(window.getSelection?window.getSelection():document.getSelection?
document.getSelection():document.selection.createRange().text))+'&v=6&';
a=function()
{
if(!window.open(f+'noui=1&jump=doclose','deliciousuiv6','location=1,links=0,scrollbars=0,to
olbar=0,width=710,height=660'))
{
location.href=f+'jump=yes'
}
};
if(/Firefox/.test(navigator.userAgent))
{
setTimeout(a,0);
}
else
{
a();
}
})()