Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div style="color: red; font-family: sans-serif; font-size: 32px; margin: 2em;" onclick="gblPDFWdw('http://samplepdf.com/sample.pdf')">An onclick action runs the Javascript function to open the other tab.</div>
  
</body>
</html>
 
function gblPDFWdw(pdf) {
    var formDiv = document.createElement("div");
    formDiv.innerHTML = "<form method=post action='" + pdf + "' target='_blank'><input type='hidden' id='test' name='test' value='test'></form>";
    var form = formDiv.firstChild; // only want to add the form to the DOM
    document.body.appendChild(form);
    form.submit();
    form.parentNode.removeChild(form);
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
dahjellepro
0viewers