Click to See Complete Forum and Search --> : Platform Recognising Link


whookam
09-16-2004, 01:10 PM
Hi,

I'm not really a web designer but I hvae created a site for my photographic portfolio.

I have created 2 versions of a flash movie one for Mac and one for PC (due to difference in Gamma). Each movie is on a seperate html page.

I have a main page with simple enter button/image that creates a popup. I have some code that recognises the users platfom but I don't know how to use this infomation to direct the user to the correct page once the enter button is clicked.

Can anyone help?

Cheers

ranji1323
09-16-2004, 01:14 PM
Javascript

window.location.href='URL here';

Charles
09-16-2004, 02:45 PM
You'll need a default version for JavaScript free and Linux persons:

<a href="defaultVersion.html" onclick="if (/^win/.test(navigator.platform)) this.href = 'windowsVersion.html'; if (/^mac/.test(navigator.platform)) this.href = 'macVersion.html'">Flash</a>

whookam
09-16-2004, 05:42 PM
Originally posted by Charles
You'll need a default version for JavaScript free and Linux persons:

<a href="defaultVersion.html" onclick="if (/^win/.test(navigator.platform)) this.href = 'windowsVersion.html'; if (/^mac/.test(navigator.platform)) this.href = 'macVersion.html'">Flash</a>

Is there anything else I need to add to my HTML to get this to work? I added the code but nothing happens and the link goes to the default page.

Thanks for the replies though.

Charles
09-16-2004, 06:00 PM
Oops,I forgot to make the test case insensitive.

<a href="defaultVersion.html" onclick="if (/^win/i.test(navigator.platform)) this.href = 'windowsVersion.html'; if (/^mac/i.test(navigator.platform)) this.href = 'macVersion.html'">Flash</a>

whookam
09-17-2004, 04:13 AM
Beautiful, thats a real help. Thanks alot Charles.

Whookam

whookam
09-17-2004, 04:50 AM
Ooops, one more thing if I may be so bold.

Originally I was using the following code to create the new page as a centered popup which worked great. Now I'm not sure how to implement this with my new platform detecting link!

I've had a play but I don't really know what I'm doing and have had no luck.

<SCRIPT LANGUAGE="JavaScript">
<!-- Idea by: Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL: http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1600,height=1200');");
}
// End -->
</script>

<!-- STEP TWO: Use the following link to open the new window -->

<A HREF="javascript:popUp('portfolioMAC.html')">Open the Popup Window</A>

Charles
09-17-2004, 06:27 AM
* You need to make certain that you haven't made a JavaScript dependant page.

* You don't have to go through all of that to open a new window.

<a href="defaultVersion.html" onclick="if (/^win/i.test(navigator.platform)) this.href = 'windowsVersion.html'; if (/^mac/i.test(navigator.platform)) this.href = 'macVersion.html'; window.open(this.href, 'child', 'width=1600,height=1200'); return false">Flash</a>