geaddict Posted June 20, 2008 Share Posted June 20, 2008 I need to be able to use php to do exactly the following that I now do in Java - <script type="text/javascript"> if(window.print) <act on a true response and display a question on the screen or some other crap>; </script> Basically what I am after is either running this small script on a 'whatever.php' page by calling it somehow or doing it in php direct to verfiy only that the function window.print() is available on the client and then branching to a series of actions. I am very new to both Java and PHP so the simpler the explanation the better. Also is there an ifnot type directive in Java for easily reversed logic? Thanks, Link to comment https://forums.phpfreaks.com/topic/111168-php-and-javascript-method-function/ Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 PHP is server-side, not client side. You cannot copy that functionality in PHP. I mean, you could attempt to infer the client's capabilities with getbrowser()...but even that's not good enough. And yes, you can use ! just like in PHP. Link to comment https://forums.phpfreaks.com/topic/111168-php-and-javascript-method-function/#findComment-570554 Share on other sites More sharing options...
geaddict Posted June 20, 2008 Author Share Posted June 20, 2008 Now I better understand the differences between the two. Ok how could I use getbrowser() to extract the operating system type so that I can restrict users of windows based equipment to better guess which will have window.print() support in java? How can I simply return and test for OS type in php? Thanks, Link to comment https://forums.phpfreaks.com/topic/111168-php-and-javascript-method-function/#findComment-570584 Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Well, honestly, you can easily fake User Agent strings. I can make my browser be uhh....a "Superdog 9000 with extra ketchup". So don't rely on it. Why don't you just test in Javascript? P.S: It's Javascript, not Java. HUGE difference. Link to comment https://forums.phpfreaks.com/topic/111168-php-and-javascript-method-function/#findComment-570624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.