Clickable link in a JavaScript alert()
a70m
Posted messages
3121
Status
Contributor
-
a70m Posted messages 3121 Status Contributor -
a70m Posted messages 3121 Status Contributor -
Hello,
I've created a PHP script that identifies a member's browser on my site. If the browser is Internet Explorer, it displays this:
<script language="JavaScript1.2"> { alert('Your browser is Internet Explorer. For more security and faster navigation, I recommend downloading Mozilla Firefox. You can download it from Mozilla\'s site: http://www.mozilla-europe.org/fr/firefox/'); }</script>
Actually, I wanted to know if it's possible to make the link I put clickable?
Thank you
A70M
--
If one day the desire to work comes to you, sit down and wait for it to pass...
Configuration: Asus X50RL • ASUSTeK Computer Inc. F5RL 1.0, • Intel Core 2 Duo T2310 1.46 GHz, • 15.4" LCD, • 2GB DDR2 RAM, • Hitachi 160GB HDD (+ Iomega Select Portable 320GB 2.5" + Western Digital My Passport Essential 160GB 2.5") • ATI Radeon Xpress 1100 Windows XP Pro - SP3 ; Google Chrome 3.0.195.33, Mozilla Firefox 3.5.5, Opera 10.01, Safari 4.0.3 (531.9.1), Internet Explorer 8.0 Ubuntu 9.10 ; Mozilla Firefox 3.0.15
I've created a PHP script that identifies a member's browser on my site. If the browser is Internet Explorer, it displays this:
<script language="JavaScript1.2"> { alert('Your browser is Internet Explorer. For more security and faster navigation, I recommend downloading Mozilla Firefox. You can download it from Mozilla\'s site: http://www.mozilla-europe.org/fr/firefox/'); }</script>
Actually, I wanted to know if it's possible to make the link I put clickable?
Thank you
A70M
--
If one day the desire to work comes to you, sit down and wait for it to pass...
Configuration: Asus X50RL • ASUSTeK Computer Inc. F5RL 1.0, • Intel Core 2 Duo T2310 1.46 GHz, • 15.4" LCD, • 2GB DDR2 RAM, • Hitachi 160GB HDD (+ Iomega Select Portable 320GB 2.5" + Western Digital My Passport Essential 160GB 2.5") • ATI Radeon Xpress 1100 Windows XP Pro - SP3 ; Google Chrome 3.0.195.33, Mozilla Firefox 3.5.5, Opera 10.01, Safari 4.0.3 (531.9.1), Internet Explorer 8.0 Ubuntu 9.10 ; Mozilla Firefox 3.0.15
16 answers
-
Sorry, no, that’s not possible
If you want to be able to do it, you need to create a window in HTML, like this example https://jqueryui.com/dialog/
Dorian
--
You’re not using VHS anymore, so why IE6? -
Thank you for your quick response, I took a look, but I don’t quite understand ...
I replaced my alert() with<script type="text/javascript"> $(function() { $("#dialog").dialog(); }); </script> <div id="dialog" title="Info"> <p>Your browser is Internet Explorer. For more safety and speed during your browsing, I recommend downloading Mozilla Firefox. You can download it on the Mozilla site <a href="http://www.mozilla-europe.org/fr/firefox/" target=_blank>Mozilla</a></p> </div>
But it doesn’t look at all like on the site :/
--
If one day you feel like working, sit down and wait for it to pass ... -
Otherwise you use the confirm() method instead of alert(): if he clicks OK, and then you redirect him to the FF download site
-
Yes, I thought about it, only the alert appears when the contact logs in to the site with their credentials. So if they click OK, they go to Mozilla’s site; if they cancel, they will never be able to connect if they are using Internet Explorer.
Or I’m not trying to force them to stop using IE (though that could be a solution ... )
A70M
--
If one day the urge to work takes you, sit down and wait for it to pass ... -
jQuery UI uses the jQuery library
so you must first download it and then include it in your page
--
You no longer use VHS, so why IE6? -
Oh okay. But I don’t know this language/library at all. I’ll keep the JAVA alert()
Thanks anyway
--
If one day the urge to work comes over you, sit down and wait for it to pass ... -
And you also need to take the CSS and images with JQuery UI.
--
Your computer doesn’t do what you want ... but what you tell it to do. -
lol it's JavaScript, not Java
Java has nothing to do with it
--
You no longer use VHS, so why IE6? -
"Yes I thought about it, only the alert is displayed when the contact connects to the site with their credentials. So if he clicks OK, he goes to Mozilla's site; if he cancels, he will never be able to connect if he uses Internet Explorer. "
=>wait, I didn't understand what you want: do you want the alert to appear before authentication or after? -
Yes JavaScript sorry ... It's a habit :$
--
If one day the urge to work takes you, sit down and wait for it to pass ... -
JessayeDeTrouver > When the user clicks on sign in, my script runs and detects the browser. If the response is Internet Explorer, it will display the alert to them.
So if I place a confirm(),
if they click yes > Mozilla Site
if they click no > Authentication canceled and thus impossible under IE.
--
If one day, the urge to work strikes you, sit down and wait for it to pass ... -
Either way, it’s not a problem.
But he wants the visitor to stay on the site (and log in if it’s before), whether or not they choose to use Firefox.
PS: To look more stylish and give the user more freedom, you could display the images of the most well-known browsers (Firefox, Chrome, Opera, Safari) and show below each the name of the browser as a link.
--
Your computer doesn’t do what you want it to do... but what you tell it to do. -
But where should I put the image?
should I put in some jQuery, right?
--
If one day, the urge to work takes you, sit down and wait for it to pass ... -
"if he says no > Authentication canceled and therefore impossible under IE". => No, not necessarily, if he clicks on no, and you simply perform a redirect to his account.
-
It suffices to store the image (browser logos) in a folder and insert it into the div with HTML.
And JQuery with the UI plugin will take care of rendering the div as an alert.
--
Your computer does not do what you want... but what you tell it to do. -
Okay, I will try
Thank you all for your information (two of you have already helped me) it’s nice to be helped so well and quickly.
Looking forward to it :)
--
If one day, the urge to work comes over you, sit down and wait for it to pass ...