Let's write a browser inside the browser, in Javascript!
Popup for External Links (jquery)
I have been asked by multiple clients lately to provide a feature that will cause ANY link to an external site, alert the user that they are leaving the site before they go. At first I was unsure how to do this, but jQuery made it beautiful, as it does most things.
Step 1. Download jQuery
Step 2. Download jQuery UI
Step 3. create a file with the following code as its contents.
$(document).ready(function() { // Creating custom :external selector $.expr[':'].external = function(obj){ return !obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname); }; // Add 'external' CSS class to all external links $('a:external').addClass('external'); $('.external').click(function() { var link = $(this).attr('href'); $('<div>You are currently leaving our site, and headed towards: <br /> '+(link)+' <br /> are you sure you want to proceed?</div>').dialog({ title: "External Link", modal : true, overlay: { backgroundColor: '#000', opacity: 0.5 }, buttons: { 'Okay': function() { $(this).dialog('close').remove(); window.open(link); }, 'Cancel': function() { $(this).dialog('close').remove(); return false; } } }); return false; }); });
Step 4. Include those three files on your site. Remember jQuery first, then UI, then the script pasted above.
Step 5. If you want to use the theme that you downloaded bundled with jQuery UI, you will need to include the .css file from that theme. When you download UI, you get a CSS folder, inside that is a theme folder, and inside that is your css file.
This is a screenshot of what it looks like with the start theme:




Comments
20 July 2009
23 weeks 6 days
Sweet! This would be a great addon to Drupal's External Links module, which wraps the logic of determining external links in an admin UI.
I need to start using jQuery UI more often...modal boxes are so much better than confirm()!
This could be especially useful for organizations with separate c3/c4 sites. The IRS requires the sites be clearly differentiated, so a popup that would inform users they were leaving one for the other would allow for copious linking while making the legal distinction clear.
I was interested in your article. I'm pleased you are using JQuery - it is very reliable and convenient. JQuery - Library of JavaScript, focusing on the interaction between JavaScript and HTML. Library JQuery helps easy access to any part of the DOM, refer to the attributes and content of the DOM, to manipulate them. JQuery Library also provides a convenient API for working with Ajax.
Features of JQuery:
* Move the tree DOM, including support for XPath as a plug;
* Event;
* Visual effects;
* AJAX-applications;
* JavaScript-plugins.
This useful information about JQuery, I found torrents search engine.
I was interested in your article. I'm pleased you are using JQuery - it is very reliable and convenient. JQuery - Library of JavaScript, focusing on the interaction between JavaScript and HTML. Library JQuery helps easy access to any part of the DOM, refer to the attributes and content of the DOM, to manipulate them. JQuery Library also provides a convenient API for working with Ajax.
Features of JQuery:
* Move the tree DOM, including support for XPath as a plug;
* Event;
* Visual effects;
* AJAX-applications;
* JavaScript-plugins.
This useful information about JQuery, I found torrents search engine.
Dude,this is way sweet.. Thanks and congrats.
Yes, thank you for this! I really appreciate all the internet help.
This is cool! I'm actually only using the custom :external selector and then using it with the cluetip plugin rather than jQuery UI, but the :external selector is brilliant!
I ran into a little hiccup on a site that is using the obtrusive "javascript:window.print();" as the href value. This was being treated as if it were an external link. So I added a check for "&& !obj.href.match(/^javascript\:/) "
The full custom selector code now looks like:
$.expr[':'].external = function(obj){
return !obj.href.match(/^mailto\:/)
&& !obj.href.match(/^javascript\:/)
&& (obj.hostname != location.hostname);
};
Well, first thanks for the code. I will try this in my host now.
Well, first thanks for the code. I will try this in my host now.
Well, first thanks for the code. I will try this in my host now.
HADİ BAKALIM
hadi spam yok kocumdertghj kas kasadet sancısına ne iyi gelirhadi garierotik film izle - fersbuk - aşk falı - dertyli - - henbi fesbuk - gerdsacvbnm sıcak sohbet
- - - ferdsazx - gertyu -escort bayanlar hertfders - bedava film izle - gertyuliseli kızlar -fersd aşk şiirleri - merty çet -certylş şifalı bitkiler ve faydaları - gbnmöç. gtredsa - islami çet treds-playboy güzelleri bgtyuıop - çet hyuopğ jklşi
çet sohbet - hjklşhikayeler - htres çet sohbet asd
müzik dinle fgtre -sohbet - gbnmöçtürkü dinle jmöç
şarkı dinle ujklş
film izle uıkl - cinsel pozisyonlar grtyu
-frty sohbet netlog - kızlarla sohbet
rted- sohbet - gerkapak laflar - ert
peki doğum günü sözleri keri korku filmi izle hadi gari
I usually buy essay or pre written essays about this post*.
Hi , Thanks for works..
sexchat
sexsohbet
gay sohbet
sex sohbet
cinsel sohbet
sohbet siteleri
çet odaları
canlı sohbet
sohbet kanalları
sohbet
sohbet kanalları
görüntülü sohbet
chat siteleri
sohbet siteleri
mirc
mirc sohbet
cinsel sohbet
kameralı sohbet odaları
kameralı sohbet
görüntülü chat
kameralı sohbet
kameralı chat
canlı sohbet
canlı chat sohbet
sohbet siteleri
chat siteleri
chat sohbet siteleri
seks sohbet
sex sohbet
sekssohbet
görüntülü çet
komik sözler
Hi , Thanks for works..
sexchat
sexsohbet
gay sohbet
sex sohbet
cinsel sohbet
sohbet siteleri
çet odaları
canlı sohbet
sohbet kanalları
sohbet
sohbet kanalları
görüntülü sohbet
chat siteleri
sohbet siteleri
mirc
mirc sohbet
cinsel sohbet
kameralı sohbet odaları
kameralı sohbet
görüntülü chat
kameralı sohbet
kameralı chat
canlı sohbet
canlı chat sohbet
sohbet siteleri
chat siteleri
chat sohbet siteleri
seks sohbet
sex sohbet
sekssohbet
görüntülü çet
komik sözler
Thanks for comments..
chat sohbet odaları
chat sohbet odası
güzel kızlar
anlamlı sözler
aşk mesajları
cinsel sohbet odaları
cinsel sohbet
All people deserve wealthy life time and business loans or just secured loan would make it much better. Because people's freedom is based on money state.
Post new comment