admin管理员组文章数量:1304149
In my LAMP stack application I create invoices in pdf format. The first screen allows selections of purchase items to be included in the invoice. My pdf opens in a new tab using the $_POSTed form data which works fine, but I would also like to simultaneously reload the first page as I also update the status of purchases selected for the pdf invoice and I want the selection screen to reflect this. Any ideas anyone? NB Native Javascript or PHP solutions only please.
In my LAMP stack application I create invoices in pdf format. The first screen allows selections of purchase items to be included in the invoice. My pdf opens in a new tab using the $_POSTed form data which works fine, but I would also like to simultaneously reload the first page as I also update the status of purchases selected for the pdf invoice and I want the selection screen to reflect this. Any ideas anyone? NB Native Javascript or PHP solutions only please.
Share Improve this question edited Oct 25, 2018 at 20:38 Rytis 1,4451 gold badge19 silver badges39 bronze badges asked Feb 11, 2013 at 21:46 PeterPeter 2114 silver badges12 bronze badges 4- I think you are looking for something like this: stackoverflow./questions/4059179/… – alu Commented Feb 11, 2013 at 21:51
- Close, but no cigar - that Q is to do with refreshing a child window from parent. I want to open a child window and refresh the parent at the same time. – Peter Commented Feb 11, 2013 at 21:57
- @Peter, reload and check my answer. – Lawrence Cherone Commented Feb 11, 2013 at 21:59
- I just had exactly the same problem as you, im building exactly the same thing as you :) it would be interesting to see what you're doing :D – AndrewBramwell Commented May 23, 2017 at 21:33
1 Answer
Reset to default 8Perhaps something like this:
<a onclick="open_in_new_tab_and_reload('./path_to_pdf.pdf')" href="#">PDF</a>
<script>
function open_in_new_tab_and_reload(url)
{
//Open in new tab
window.open(url, '_blank');
//focus to thet window
window.focus();
//reload current page
location.reload();
}
</script>
本文标签: javascriptLaunch a new tab and reload original pageStack Overflow
版权声明:本文标题:javascript - Launch a new tab and reload original page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741748178a2395663.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论