html and frameset |
html and frameset |
EveMene |
Nov 17 2017, 08:07 AM
Post
#1
|
Group: Members Posts: 2 Joined: 17-November 17 Member No.: 26,537 |
Hi,
I'm a real noob here So my question can seem a little too easy/obvious I have this: CODE <html> <frameset rows='170,*'> <frame name=nav src = nav.php4> <frame name=affiche src=retro.php4> </frameset> </html> And I would like to have something like this: CODE <html> <script> var browserName = ' ' + navigator.userAgent.toLowerCase(); if (browserName.indexOf("chrome") >= 0) { <frameset rows='190,*'>; } else { <frameset rows='170,*'>; } </script> <frame name=nav src = nav.php4> <frame name=affiche src=retro.php4> </frameset> </html> But like you can image, this is not working. Can someone help me to resolve my problem? |
Christian J |
Nov 18 2017, 06:01 AM
Post
#2
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
Here's a script that in theory (I haven't tested) should change the frameset row height, if the browser's UA string contains the word "chrome":
CODE <script> function rows_height() { var browserName = navigator.userAgent.toLowerCase(); if (browserName.indexOf("chrome") !=-1) { document.getElementsByTagName('frameset')[0].setAttribute('rows', '190,*'); } } window.addEventListener('DOMContentLoaded', rows_height, false); </script> <frameset rows='170,*'> <frame name=nav src = nav.php4> <frame name=affiche src=retro.php4> </frameset> In other cases (or if javascript is disabled) the ROWS height defaults to the "170,*" set in the HTML. Note that browsers are historically known to obfuscate their UA strings, so it's quite possible that non-Chrome browsers include the word "chrome" as well, now or in the future. |
pandy |
Nov 18 2017, 11:25 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,733 Joined: 9-August 06 Member No.: 6 |
I agree with Christian, this is the wrong way to go. And even if you do stick with frames, modifying a frame for a specific browser is wrong. Find out why the page acts differently in Chrome instead. We can help you, but as Christian said we need to see the whole thing to be able to.
|
Lo-Fi Version | Time is now: 27th April 2024 - 06:02 AM |