beezee / djax

Dynamic pjax, responds to layout changes across requested pages
http://beezee.github.com/djax.html
171 stars 27 forks source link

how can i say dont use djax for target="blank" link #27

Open akinayturan opened 11 years ago

akinayturan commented 11 years ago

hi i want to open some internal link in new window without old page reload but it is not posible for now, do you have any solition for this ?

example: < a href="site-com/sitemap.xml" target="_blank">Sitemap< /a>

i found a solution with this but its not good, every time page reload :)


$('body').on('click', 'a[target^=_blank], a[rel^=external], function(e) {  
        window.open($(this).attr('href'));
    location.reload();
        return false;
      });   
beezee commented 11 years ago

Right now djax only skips links based on their target href- this is definitely an area that needs improvement.

My thought is that target="_blank" should automatically be skipped, based on the usual behavior of a link with that attribute set. The best way to do this would be to check for it around line 71 and set exception to true if it's found.

I will try to look into implementing this weekend, unless you are able to make the change first and want to open a pull request.

Thanks for bringing this up.

akinayturan commented 11 years ago

ths man for answer djax already enough awesome :)

i do like that if some one have same question

firstly i looked and close to see sitemap

jQuery(document).ready(function($){$('body').djax('sitemap','wp-admin','wp-login']);});

and i look is there any target :)


/*! blank new page*/
$('body').on('click', 'a[target^=_blank], a[rel^=external], area[target^=_blank]', function(e) {  
    window.open($(this).attr('href'));
    return false;
});