Click to See Complete Forum and Search --> : open a link in IE only?


sanjuT
09-02-2003, 10:34 AM
i was wondering if there is a way to have a link open only in IE.

I know how to open a link in a new window, but if the user was using, say, Netscape, can a link open IE from there?

THANKS!

DaveSW
09-02-2003, 10:56 AM
Indulging in a little discrimination are you? Rather mean on the netscape people eh what? LOL

Perhaps you could find someone to write you a javascript/php etc that would then detect what browser the person is using and decide what content to add.

sanjuT
09-02-2003, 11:01 AM
so it is possible?

i know it's a bit discriminatory, but that's the task i have been told to do from the 'higher-ups'..

DaveSW
09-02-2003, 11:20 AM
What server side languages does your server support? That will dictate who to ask. Unless it's for internal use? Then could you use javascript?

sanjuT
09-02-2003, 11:21 AM
we have a few servers here, we could use almost any language.

if it can be done w/ javascript, that would be preferrable.

the questions is, how?

THANKS!

DaveSW
09-02-2003, 11:25 AM
With javascript you just need to adapt this script: http://www.w3schools.com/js/tryit.asp?filename=tryjs_crossbrowser2

With php, do what everyone else does and ask pyro (his IM status is working at the mo, so he may be busy. However, his bro was about earlier, so maybe...)

Perhaps you could post in a forum of your choice, asking for a script to:

Detect the users browser
Print a hyperlink to the page if it is IE
Print a message to Netscape to tell them to open IE...

Hope this helps

DaveSW
09-02-2003, 11:28 AM
btw I've IM'd Pyro. He's busy at the mo but I've asked him to look later.

sanjuT
09-02-2003, 11:38 AM
Thanks a lot!

i don't know all the IDs of people here, i'm glad u IM'd Pyro for me.

I'll take a look at that link u supplied.

i thought i might be able to accomplish this by fiddling around within the a href tag..oh well..

pyro
09-02-2003, 11:41 AM
Dave asked me to take a look at this quick... Here's the PHP solution:

<?PHP
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match("/MSIE/",$user_agent)) {
echo '<a href="http://www.webdevfaqs.com">Web Dev FAQs</a>';
}
else {
echo "You must use IE to view this page.";
}
?>and here's the javascript solution:

<script type="text/javascript">
user_agent = navigator.userAgent;
if (user_agent.match(/MSIE/)) {
document.write('<a href="http://www.webdevfaqs.com">Web Dev FAQs</a>');
}
else {
document.write("You must use IE to view this page");
}
</script>Ok, off to work again... ;)

DaveSW
09-02-2003, 11:43 AM
LOL - thanks Pyro!

sanjuT
09-02-2003, 11:46 AM
Thanks Pyro, and Dave!!!

So i guess the best that's possible is to have the 'Must use IE' part, it's impossible to open a link in IE from other browsers?

pyro
09-02-2003, 11:49 AM
Happy to help. Also, yes, you can't open IE from other browsers... The best you can do is print a message (actually, the best would be to make your pages cross-browser, as Dave already stated)...

sanjuT
09-02-2003, 11:53 AM
thanks, yes that would be best..but it's outta my hands, it's up to the brainiacs i work for..;)

sanjuT
09-02-2003, 12:16 PM
someone just told me that it might be possible using VB, does that sound right?

pyro
09-02-2003, 12:26 PM
VB is IE only, so you could probably just use it to write the link... I would use PHP, as it will work for all browsers.

spufi
09-02-2003, 12:49 PM
I use Mozilla and I have had a IE window open on me before. I didn't look into how it was done, but I have seen it happen. Maybe it's something within my own settings I need to change, but again, it can happen.

pyro
09-02-2003, 01:19 PM
Hmm.. I'm a bit surprised about that. I'd think if anything, things like that would happen when using IE (due to the many bugs...)