Why does twitter bookmarklet does not get blocked by popup blocker?
Check this link. http://dev.twitter.com/pages/share_bookmarklet
Drag bookmarklet to your bookmark-bar and click on it. It will open a pop up window.
Why is my firefox/ie/chrome not blocking this?
Thanks
javascript:
function loadScript(scriptURL) {
var scriptElem = document.createElement('SCRIPT');
scriptElem.setAttribute('language', 'JavaScript');
开发者_如何转开发scriptElem.setAttribute('src', scriptURL);
document.body.appendChild(scriptElem);
}
var url = 'http://api.bit.ly/shorten?version=2.0.1&login=tweetthees&apiKey=Rxyz&longUrl=' + document.location;
var longUrl = document.location;
loadScript(url + '&callback=tweetme');
function tweetme(json) {
var shortLink = json.results[longUrl].shortUrl;
var finalUrl = 'http://twitter.com/home?status=Reading: ' + document.title + ' ' + shortLink;
window.open(finalUrl, "Share link", "width=1024,height=400,location=1,status=1,scrollbars=1");
}
Usually popup-blocker don't block popups general, they only block popups that should be opened without any user-action. Thats not the case if you use bookmarklets, because the user selects the bookmarklet before the popup opens. When using a bookmarklet it may be, that this would'nt get observed by a popup-blocker, like Nick said(I think there is no need to, a bookmarklet should be trusted).
But in a webpage this popup also would'nt be blocked, if the function was called following a click-event.
Bookmarklets aren't typically blocked by the browser's popup blocker, you're intentionally invoking it....so it's a popup you wanted, presumably, since you added the bookmarklet in the first place.
First of all pop-up windows created as a response to user actions are not blocked usually. By the way, standard twitter bookmarklet may not release memory, so I suggest to use enhanced twitter bookmarklet It allows to select text on any page and post it to Twitter. And what is more important it releases the memory allocated for popup window.
精彩评论