Skip to content

Instantly share code, notes, and snippets.

@shaliko
Created August 18, 2011 13:00
Show Gist options
  • Save shaliko/1154019 to your computer and use it in GitHub Desktop.
Save shaliko/1154019 to your computer and use it in GitHub Desktop.
DEPRECATION WARNING: :popup has been deprecated
//jQuery
$('a[data-popup]').live('click', function(e) {
window.open($(this).href);
e.preventDefault();
});
//Prototype.js
document.on("click", "a[data-popup]", function(event, element) {
if (event.stopped) return;
window.open($(element).href);
event.stop();
});
<!-- Inline -->
<a href="javascript:window.open('/my_controller/my_method/id','popup_name','height=400,width=580,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes')">Link name</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment