Jump to content

Simple Script To Determine Platform And Load Correct Image?


IanS

Recommended Posts

There are doubtless examples of a script to determine which platform a user is on and load something accordingly - maybe someone could point me to the right place? This instance is due to unresolved problems getting color critical graphics to appear the same on Mac/PC (generally), and needing to get the page up urgently, I temporarily need to load different versions of the graphic depending... thanks,ianS PS. nice looking forum, btw. Will go check out invision...

Link to comment
Share on other sites

Can you explain why, exactly, do you need to distinguish between platforms?I wasn't aware of images appearing differently on different platforms. There's the navigator.platform object in Javascript, but I think it's best to first try to get to the root of the problem and find a platform-independent solution. The web is supposed to be characterized by not being platform dependent.

Link to comment
Share on other sites

Wow, that was quick! Yes, I'm still trying to figure out why the graphics are showing different on Mac and PC screens. Technically there should only be minor differences, but I'm having a seriously different 'greens' issue! Not sure what the technicals are re platform and screens used, but generally all PCs I've checked on are not showing it as it should be. Work in progress there... Someone suggested a temporary quick fix of using javascript to find which platform folks are on and feeding a different image. I'm not expert or even very familiar with js so would need to know what the script should say to either go to different pages or load up either one of two images. That's why I came on here. Any thoughts on the matter would be welcome! ianS

Link to comment
Share on other sites

That's strange. I'd try to research about colors on different platforms. Anyways, if you want to change the image when on a Windows platform, something like this might work: Give an image with the ID "myimage":<img id="myimage" src="image1.jpg" alt="image">

window.onload = function() {  if(navigator.platform == "Win32") {	document.getElementById("myimage").src = "image2.jpg";  }}

A quick search reveals this: http://www.cgsd.com/papers/gamma.web.html

Link to comment
Share on other sites

Thanks, that sounds like just the ticket :good:I presume if not Win32 then the normal image will load? Hopefully I'll get these colors figured before too long... cheers,ianS--- The link here is a bit out of date, btw.Macs now use 2.2 gamma. sRGB should be the same generally for all consumer devices these days. Though Microsoft seem to have invented wsRGB which only confuses the issue... The color in question here is 8cb272. On a Mac this is a pale sage but quite bright. On PCs it shows dark, unsaturated and dull. On the same image an orange has hardly changed and is quite acceptable. These colors must be right or the logo just looks stupid!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...