Good all the time of the day gentlemen. Second time today

The internet is full of different scripts automatically navigate to the desired link. Some of them need to poke between the tags HEAD (and so be it), something that can be written directly in BODY.

Is it possible to write such a script so that it can be used only inside BODY? ( No answer too )

ps to register is not lazy, wonders whether it will work so correctly

    3 answers 3

    <script language="JavaScript" type="text/javascript"> location="ti_ploho_guglil.php" </script> 
    • works. but the code is suspiciously short O_o - sergey

    If you simply ensure that the script does not work in head , then you can use this line:

     document.body.any; 

    If you need to check where the script is, you can:

     document.querySelector('body script') 

    If it is in the head , the result will be null , if in the body , then no.

    Naturally, both of these codes assume execution directly in the script outside of any asynchronous operations, including without waiting for the document to finish loading.

      Set window.location to something like this:

       <!DOCTYPE html> <html> <head> <title>перенаправил</title> </head> <body> <script language="JavaScript" type="text/javascript"> window.location = "/T4D/index.222.php" </script> </body> </html>