javascript - Open page in new tab/window AND direct current window to a new url -


i have set form action "_blank" pdf document creating opens in new tab/window, works fine want source page simultaneously redirect different url. how can done? html and/or javascript solutions please. in advance.

add onsubmit form , change location.href. worked fine in ie10, failed in chrome.

<form id="form1" onsubmit='formonsubmit();' method="get" action="http://google.com" target="_new">     <input type="submit" value="submit" /> </form>                                     <script type="text/javascript">     function formonsubmit() {         location.href = "http://stackoverflow.com";     } </script> 

for purists, add onsubmit via handler, works in both ie , gc:

<form id="form1" method="get" action="http://google.com" target="_new">     <input type="submit" value="submit" /> </form>                                     <script type="text/javascript">     $(function() {         $("#form1").on("submit", function () {             location.href = "http://stackoverflow.com";         });     }); </script> 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -