I have defined a function in which i want to open a page on a new window. The function has following code:
echo"<script>window.location.href='http://localhost/paymentsystem/views/payment.php?id=".$id."'</script>" ;
Right now its opening the page on the same window.
I want to know how can i open this page on a new tab?
Regards,
Pankaj
Try:
window.open("yourSite.html","plain","width=470,height=452");
instead of window.location.href
if you prefer to use html to open new window then you have to use below
<a href="example.html" target="_blank">link text</a>
and to implement it in javascript you have to try below
echo"window.open(' http://localhost/paymentsystem/views/payment.php?id= ".$id."')" ;
I hope this will help you..
Thanx.
You can also use
<a href="http://example.com" target="_blank">Click here</a>
for a simpler solution, although I believe the 'target' attribute will be deprecated soon.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.