Link to home
Start Free TrialLog in
Avatar of peps03
peps03

asked on

open jquery dialog with php / open javascript function with php

Hi!

i want a piece of php code to check what type of browser someone is using and make a jquery dialog open if they use MIE.

The dialog works, the php browser check-code works, but i cant get the php-code to open the jQuery dialog window..
What am i doing wrong?

here are the codes i'm using:

thanks!
BROWSER CHECK AND OPEN DIALOG:

<?  
ini_set('display_errors', 'On');
error_reporting(E_ALL);

    if (isset($_SERVER['HTTP_USER_AGENT']) && 
    (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
       echo "<script type=\"text/javascript\">IEuser();</script>";
    else
        echo "Yes, you're not using IE!<br><br>";
?>

Open in new window

OPEN DIALOG:

<script type="text/javascript">
function IEuser() { 
        $('#dialog').dialog('open');
};
</script>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jrm213jrm213
jrm213jrm213
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peps03
peps03

ASKER

thanks for your reply jrm!

it isn't opening the dialog. instead, i get this error from ie:

Message: Object expected
Line: 65 ===<script type="text/javascript">$(document).ready(function (){IEuser();});</script>
Char: 31
Code: 0
URI: http://localhost/pepijnniesten.nl/index2.php


Is it all versions of IE or just IE6?
Try removing the "type" from your <script> tags, especially for including jquery.

<script language=”javascript” src=”your-path-to-jquery-version.js”></script>
Avatar of peps03

ASKER

Thanks JRM, your first post was actually working!

I had a typo in my javascript function.. "IEuser"

Thank you very much!