Page 1 of 1
Add width and Height parameter to newwindow
Posted: Fri Feb 18, 2022 6:53 am
by radhavallabh
Hi all;
I need open the link in new window with width and height defined to it.
Currently it opens in a new tab and no new small window as desired.
Code: Select all
<?php echo $Admin->button(TEXT_ADD_NEW_PRODUCT,'', 'btn-light', $Admin->link('edit_orders_add_product.php')->set_parameter('oID', $_GET['oID']), ['newwindow' => true]); ?>
Please can you guide me on how to add the width and height parameters to the newwindow above.
Thank you in advance;
Very Warm Regds./
radhavallabh
Re: Add width and Height parameter to newwindow
Posted: Fri Feb 18, 2022 7:33 am
by ecartz
https://stackoverflow.com/questions/224 ... 0_22444611 says
Code: Select all
<a href="yourpage.htm" target="_blank" onClick="window.open('yourpage.htm','pagename','resizable,height=600,width=800'); return false;">New Page</a>
So
Code: Select all
<?php
$edit_orders_add_product_link = $Admin->link('edit_orders_add_product.php')->set_parameter('oID', $_GET['oID']);
echo $Admin->button(TEXT_ADD_NEW_PRODUCT,'', 'btn-light', $edit_orders_add_product_link, ['newwindow' => true, 'onclick' => "window.open('$edit_orders_add_product_link','" . TEXT_ADD_NEW_PRODUCT . "','resizable,height=600,width=800'); return false;"]); ?>
Note: I can't promise the code to open a new window does exactly what you want, but that's how to make that particular example work in the context of an Admin button.
Re: Add width and Height parameter to newwindow
Posted: Fri Feb 18, 2022 8:26 am
by radhavallabh
ecartz wrote: ↑Fri Feb 18, 2022 7:33 am
https://stackoverflow.com/questions/224 ... 0_22444611 says
Code: Select all
<a href="yourpage.htm" target="_blank" onClick="window.open('yourpage.htm','pagename','resizable,height=600,width=800'); return false;">New Page</a>
So
Code: Select all
<?php
$edit_orders_add_product_link = $Admin->link('edit_orders_add_product.php')->set_parameter('oID', $_GET['oID']);
echo $Admin->button(TEXT_ADD_NEW_PRODUCT,'', 'btn-light', $edit_orders_add_product_link, ['newwindow' => true, 'onclick' => "window.open('$edit_orders_add_product_link','" . TEXT_ADD_NEW_PRODUCT . "','resizable,height=600,width=800'); return false;"]); ?>
Note: I can't promise the code to open a new window does exactly what you want, but that's how to make that particular example work in the context of an Admin button.
Thank you so much for the explanation and code update dear!! It works perfectly

Thank you so much again!!!
Very warm Regds./
radhavallabh