View Full Version : Browser specific code?
Cases By Source
06-26-06, 05:13 PM
Is it possible to setup conditoinal statemtns for browser specific code?
Like if
mozila
display this miva code
if else
display that miva code?
Vic - WolfPaw Computers
06-26-06, 05:40 PM
Yes. With javascript to detect the browser.
Search Google, there are tons of sample code snippets out there.
Bruce - PhosphorMedia
06-26-06, 05:48 PM
Also, if you are talking about actual MivaScript, you can get the Browser information by evaluating 's.http_user_agent', which would be preferable since it does not rely on Javascript. Simular variables exist in other languages such as PHP as well.
Cases By Source
06-26-06, 06:04 PM
Well im having some kind of display problem with my category tree list...rather whats under it is having the problem
view this in mozilla.
http://dev2.casesbysource.com/merchant.mvc?Screen=CTGY&Category_Code=bc
the search box jumps to the right.
It displays normal in IE
I found if added a 2 breaks it displays normal in mozilla but displays down a bit further than I would like in ie so i figured if i could integrate some browser specific code it would fix the problem.
Any other thoughts direction or thoughts would be appreciated.
Bruce - PhosphorMedia
06-26-06, 07:20 PM
I think I would still lean towards doing a CIN test on s.http_user_agent, and either use it to select a different style sheet or style statement...
Pete McNamara
06-26-06, 09:58 PM
This is not a browser issue. Your problem and solution is the same as in this thread:
http://extranet.miva.com/forums/showthread.php?p=9523#post9523
Your left column should be 166px wide, right? If so, then you can't have tables in it that are larger than 166px. So a table like this that has a width of 204px, will cause it to jump right in browsers that interpret the code as you wrote it:
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="125" class="bask02"><div align="center">
<input name="textfield2" type="text" class="bask01" value="Your Email Here!" size="20">
</div></td>
<td width="79"><div align="right">
<input name="Submit" type="submit" class="bask01" value="Join!">
<input name="m" type="hidden" id="m" value="1011214174518">
<input name="p" type="hidden" id="p" value="oi">
</div></td>
</tr>
</table>
Try this instead:
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="105" class="bask02"><div align="center">
<input name="textfield2" type="text" class="bask01" value="Your Email Here!" size="20">
</div></td>
<td width="51"><div align="right">
<input name="Submit" type="submit" class="bask01" value="Join!">
<input name="m" type="hidden" id="m" value="1011214174518">
<input name="p" type="hidden" id="p" value="oi">
</div></td>
</tr>
</table>
Pete McNamara
06-26-06, 11:53 PM
Actually, now I have had time to test it again, that doesn't fully solve your problem. The problem is you have numerous coding errors in the page:
1. at least one table with a width greater than the column it's in
2. numerous links to stylesheet sprinkled throughout the body (you only need one - in the head section)
3. style information in the body that belongs either in the head tag or more better still, in the external stylesheet
4. td's with classes where you have defined the width in the table (you only need to define the widths in the external stylesheet)
5. category tree links with a width greater than 170px. Your cat1 has a width of 166 to which you add your left and right margin of 4px total plus your indent of 2pt = say, 172px. You need to reduce the width of the link by the width of each indent (use px not pt, for consistency)
Unfortunately I don't have any more time to work on this but there must be other errors too.
In summary, your problem is one of coding errors - it is not a browser related issue.
There is only one one to solve the problem, in my experience - save a complete copy of the page from the website itself, then start deleting unnecessary stuff from that page (i.e. you are trying to reduce the amount of code you have to sort through to find all the errors. An example would be to eliminate all the rows of products except the top one i.e. part # B531 - all the others serve no function when you are trying to problem solve).
Hope this helps
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.