How Can I Craft A Greasemonkey-like Script To Show A Different Page In The Lower-third?
If you take a look at this page, there's a lot of white space in the bottom. I wish to use Greasemonkey-like script on that page, that utilises some of that white space and loads
Solution 1:
- Since you have jQuery available, use jQuery selectors to get the product link.
- Then add the iFrame but give it an id.
- Use CSS to position and size it.
The code would look like this, based on the structure of the Dropbox page you linked:
var prodLinks = $("td.product_description a:contains('View Amazon Product Page')");
if (prodLinks.length) {
var iframeSrc = prodLinks[0].href;
$("body").append ('<iframe id="gmIframe" src="' + iframeSrc + '"></iframe>');
$("#gmIframe").css ( {
"position": "absolute",
"bottom": "1em",
"left": "2em",
"height": "30%",
"width": "94%",
"z-index": "17",
"background": "#00FF00"
} );
}
Warning:
This will only work if at least one of the following conditions are met:
- The iframe is same domain.
- The iframed website doesn't forbid cross-origin framing. (www.amazon.co.ukdoes forbid such framing.)
- You are using a browser that doesn't honor the cross-origin restriction. Firefox honors it, I don't know if Fluid does or not.
Post a Comment for "How Can I Craft A Greasemonkey-like Script To Show A Different Page In The Lower-third?"