www.webdeveloper.com
Results 1 to 4 of 4

Thread: onLoad query

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    138

    onLoad query

    I have an onLoad in the Body tag which works fine in IE but not in any other browser (FFox or Chrome). is this an IE only event or should it work in other browsers?...

    <body onLoad="location.href('http:..etc...html')">

    Any help please..

    thanx..

  2. #2
    Join Date
    Mar 2011
    Posts
    1,109
    Other browsers might require 'document.location.href'.

    If you want to redirect users from one page to another, a setting in your .htaccess file would be best.

    Easiest is:
    Code:
    Redirect 301 /oldpage.html http://www.example.com/newpage.html
    Note that the 'oldpage.html' reference uses a file path, but the destination 'newpage.html' requires a complete URL starting with 'http://'.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    location.href is not a fuction. It should look like this:

    Code:
    location.href = 'http:..etc...html'

  4. #4
    Join Date
    Dec 2010
    Location
    Romania
    Posts
    26
    To avoid some suspicious and if you have a jquery reference you can try this:

    Code:
          $(document).ready(function(){
                  window.location.href = "....";
           });
    You can also use it like this: (without jquery)

    Code:
    window.onload = myFunction;
    
    function myFunction() {
    window.location.href = "....";
    }
    In both cases forget please by the onLoad attribute from < body > element
    Last edited by plaszma; 10-22-2012 at 10:17 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles