Results 1 to 3 of 3

Thread: JavaScript remote file redirect

  1. #1
    Join Date
    Sep 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JavaScript remote file redirect

    Hi,
    I wonder if anyone knows if there is a way to
    use a JavaScript redirect across a number of
    pages using a call from a remote file.

    I have tried this method without success:
    Create a .js file called myfile.js containing this script.
    <script type="text/JavaScript">
    <!--
    setTimeout("location.href = 'http://www.newpage.com';",1500);
    -->
    </script>

    Insert this script into the head tags of the web page:
    <SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT"
    SRC="myfile.js">
    <!--
    //-->
    </SCRIPT>

    I wonder if I am trying to do the impossible?

    Thanks,
    Barry.

  2. #2
    Join Date
    Sep 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default The aim of the exercise.

    Hi,
    Sorry I missed out on the aim of the exercise.
    I thought by withholding/uploading the remote .js file
    I could effectively control redirects.

    Thanks,
    Barry.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's not a good idea. Use an HTTP redirect instead.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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