Skip to content

Instantly share code, notes, and snippets.

@dvlden
Last active September 11, 2017 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvlden/3485bcdd91f313c8509f to your computer and use it in GitHub Desktop.
Save dvlden/3485bcdd91f313c8509f to your computer and use it in GitHub Desktop.
Open link(s) in small browser dialog or new tab on phones/tablets
<a
href="https://google.com"
onClick="return popThis(this.href, 500, 370)">
Open Google
</a>
function popThis (u, w, h) {
var url = u,
width = w,
height = h,
leftPosition = (window.screen.width / 2) - ((width / 2) + 10),
topPosition = (window.screen.height / 2) - ((height / 2) + 50);
window.open(// ->
url, 'popUpWindow',
"height = " + height + ", " +
"width = " + width + ", " +
"left = " + leftPosition + ", " +
"top = " + topPosition + ", " +
"screenX = " + leftPosition + ", " +
"screenY = " + topPosition + ", " +
"resizable = no, status = no, toolbar = no, menubar = no, scrollbars = no, location = no, directories = no"
// <-
);
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment