Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Redirect to mobile site
New Posts  All Forums:Forum Nav:

Redirect to mobile site

post #1 of 7
Thread Starter 
Cant get this to work. Does anyone know whats wrong?

Code:
<script type="text/javascript">
if(screen.width < 600){
window.location = "http://m.website.com";
}
</script>
post #2 of 7
Try this.

Code:
<script type="text/javascript">
if(screen.width <= 600){
window.location = "http://m.website.com";
}
</script>
Seraphim 4.0
(23 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 4930K RAMPAGE IV BLACK EDITION NVIDIA GeForce GTX 570 NVIDIA GeForce GTX 570 
GraphicsRAMHard DriveHard Drive
NVIDIA GeForce GTX 570 Corsair Dominator HGST Deskstar SATA III Mushkin Chronos Deluxe SSD 
Hard DriveHard DriveHard DriveHard Drive
Corsair SSD Seagate Seagate Western Digital 
CoolingOSMonitorMonitor
Hydro Series™ H110 280mm Extreme Performance Li... Windows 7 Ultimate x64 Dell UltraSharp U2412M Dell UltraSharp U2412M 
MonitorMonitorMonitorKeyboard
Dell UltraSharp U2412M Vizio 29" LED HDTV Dell SE198WFP DAS III Ultimate 
PowerCaseMouse
Rosewill Hercules 1600W HAF Stacker 935 + 915F Corsair Vengeance M60 
  hide details  
Reply
Seraphim 4.0
(23 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 4930K RAMPAGE IV BLACK EDITION NVIDIA GeForce GTX 570 NVIDIA GeForce GTX 570 
GraphicsRAMHard DriveHard Drive
NVIDIA GeForce GTX 570 Corsair Dominator HGST Deskstar SATA III Mushkin Chronos Deluxe SSD 
Hard DriveHard DriveHard DriveHard Drive
Corsair SSD Seagate Seagate Western Digital 
CoolingOSMonitorMonitor
Hydro Series™ H110 280mm Extreme Performance Li... Windows 7 Ultimate x64 Dell UltraSharp U2412M Dell UltraSharp U2412M 
MonitorMonitorMonitorKeyboard
Dell UltraSharp U2412M Vizio 29" LED HDTV Dell SE198WFP DAS III Ultimate 
PowerCaseMouse
Rosewill Hercules 1600W HAF Stacker 935 + 915F Corsair Vengeance M60 
  hide details  
Reply
post #3 of 7
Thread Starter 
lol wow. How could i miss something so easy >.<

Thanks Rep +
post #4 of 7
Np mate, we all miss lil' stuff like that from time to time, coding ain't easy on the eyes
Seraphim 4.0
(23 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 4930K RAMPAGE IV BLACK EDITION NVIDIA GeForce GTX 570 NVIDIA GeForce GTX 570 
GraphicsRAMHard DriveHard Drive
NVIDIA GeForce GTX 570 Corsair Dominator HGST Deskstar SATA III Mushkin Chronos Deluxe SSD 
Hard DriveHard DriveHard DriveHard Drive
Corsair SSD Seagate Seagate Western Digital 
CoolingOSMonitorMonitor
Hydro Series™ H110 280mm Extreme Performance Li... Windows 7 Ultimate x64 Dell UltraSharp U2412M Dell UltraSharp U2412M 
MonitorMonitorMonitorKeyboard
Dell UltraSharp U2412M Vizio 29" LED HDTV Dell SE198WFP DAS III Ultimate 
PowerCaseMouse
Rosewill Hercules 1600W HAF Stacker 935 + 915F Corsair Vengeance M60 
  hide details  
Reply
Seraphim 4.0
(23 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 4930K RAMPAGE IV BLACK EDITION NVIDIA GeForce GTX 570 NVIDIA GeForce GTX 570 
GraphicsRAMHard DriveHard Drive
NVIDIA GeForce GTX 570 Corsair Dominator HGST Deskstar SATA III Mushkin Chronos Deluxe SSD 
Hard DriveHard DriveHard DriveHard Drive
Corsair SSD Seagate Seagate Western Digital 
CoolingOSMonitorMonitor
Hydro Series™ H110 280mm Extreme Performance Li... Windows 7 Ultimate x64 Dell UltraSharp U2412M Dell UltraSharp U2412M 
MonitorMonitorMonitorKeyboard
Dell UltraSharp U2412M Vizio 29" LED HDTV Dell SE198WFP DAS III Ultimate 
PowerCaseMouse
Rosewill Hercules 1600W HAF Stacker 935 + 915F Corsair Vengeance M60 
  hide details  
Reply
post #5 of 7
That's really a bad way of doing it. What happens if the user is on an ipad, or a mobile tablet? They still see full site.

Try something like this out

use the PHP Mobile Browser Detection. It will detect the users Header info and redirect upon that
    
CPUMotherboardGraphicsGraphics
i7 2600k Gigabyte P67-UD4-B3 GTX 580 GTX 580 
RAMHard DriveOSMonitor
Who cares? Intel SSD  Windows 7 Dell u3011 
MonitorPowerCaseMouse
Dell u3011 Seasonic x1200 800D G700 
AudioAudio
Xonar STX Beyerdynamic DT 990 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
i7 2600k Gigabyte P67-UD4-B3 GTX 580 GTX 580 
RAMHard DriveOSMonitor
Who cares? Intel SSD  Windows 7 Dell u3011 
MonitorPowerCaseMouse
Dell u3011 Seasonic x1200 800D G700 
AudioAudio
Xonar STX Beyerdynamic DT 990 
  hide details  
Reply
post #6 of 7
Thread Starter 
I set it to 845 width which works with the ipad but i went another route instead. I use wordpress with the WPtouch plugin
post #7 of 7
Was just pointing that out for anyone else who stumbles upon this thread

Glad you got it working
    
CPUMotherboardGraphicsGraphics
i7 2600k Gigabyte P67-UD4-B3 GTX 580 GTX 580 
RAMHard DriveOSMonitor
Who cares? Intel SSD  Windows 7 Dell u3011 
MonitorPowerCaseMouse
Dell u3011 Seasonic x1200 800D G700 
AudioAudio
Xonar STX Beyerdynamic DT 990 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
i7 2600k Gigabyte P67-UD4-B3 GTX 580 GTX 580 
RAMHard DriveOSMonitor
Who cares? Intel SSD  Windows 7 Dell u3011 
MonitorPowerCaseMouse
Dell u3011 Seasonic x1200 800D G700 
AudioAudio
Xonar STX Beyerdynamic DT 990 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Redirect to mobile site