Auto-Forwarding to a new URL in iWeb

Discussion in 'Mac Basics and Help' started by dylanbrown, Jan 28, 2009.

  1. dylanbrown macrumors 6502

    Joined:
    Aug 20, 2008
    Location:
    London
    #1
    Hi there,

    I want to set-up a page in my iWeb site to auto-forward to another page in my site.

    I have tried some HTML tags - but these just put the new page inside the existing...

    Any help?
     
  2. madog macrumors 65816

    madog

    Joined:
    Nov 25, 2004
    Location:
    Korova Milkbar
    #2
    That might be a java feature...? I have no idea, but I would search for java code for redirecting and if that is the case, you should be able to modify it to your site and then add it as a html snippet or code if you have iWeb 08.
     
  3. BlueRevolution macrumors 603

    BlueRevolution

    Joined:
    Jul 26, 2004
    Location:
    Montreal, QC
    #3
    I don't know how much customization is available in iWeb, but you can do redirects with headers (probably not an option in your case), meta tags, or JavaScript.

    Using Java for the purpose would be ridiculous.
     
  4. madog macrumors 65816

    madog

    Joined:
    Nov 25, 2004
    Location:
    Korova Milkbar
    #4
    YOU'RE RIDICULOUS!

    :D

    Haha, it may be. As I said I know nothing about it. No one else had responded to his post though :(
    And I just learned that Java and JavaScript are two different things. Now that's ridiculous!

    "If you need to redirect visitors to a new page, the following redirect code will enable you to do just that.

    There are many reasons for using a redirect code within your web page. However, the most popular reason is to redirect visitors to a new web page when you've changed the location of the original web page. If you don't, your visitors will receive an error page, which will cause them to leave your web site and probably never return.

    Another good reason to use a redirect code within a web page that has moved is the Search Engines. When you create your web site and upload it to your web server, chances are, your pages will be quickly indexed by the Search Engines, as many Search Engines continually crawl the Internet in search of new web pages. If you don't use a redirect code to redirect your Search Engine visitors to your new web page, you may lose these visitors forever.

    This is why using a redirect code is so important, as it will enable you to redirect your visitors to the web page they were in search of. This will in turn keep you from losing your visitors.

    Note: When using redirect codes within your web page, please make sure you aren't using this redirect code for unethical purposes, such as trying to trick the Search Engines into ranking your web page higher. This action could get your web site banned. Please ensure you use only ethical means in which to obtain web site traffic.
    Place the following code between your HEAD tags.

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development
    window.location="http://www.yourdomain.com/";
    // -->
    </script>
    "

    Found this JS, doesn't seem all too bad if it's right... If you know what parts are required, I'm sure you could remove that advertisement part of the code.
     
  5. BlueRevolution macrumors 603

    BlueRevolution

    Joined:
    Jul 26, 2004
    Location:
    Montreal, QC
    #5
    A better way to do it would be to insert the onload event into <body> like so:

    <body onload="window.location='http://www.example.com/';">

    Uppercase HTML tags are so 1997. Alternatively, you can add a <meta> tag to your page's <head>:

    <head>
    <title>Redirect page</title>
    <meta http-equiv="refresh" content="0;URL=http://www.example.com/" />
    </head>


    If you were using PHP (which you're not in iWeb), you could also redirect with:

    header('Location: http://www.example.com/');
     
  6. dylanbrown thread starter macrumors 6502

    Joined:
    Aug 20, 2008
    Location:
    London
    #6
    Thanks for your replies....

    Thanks for all your replies, unfortunately, iWeb always (When using the code in these forum posts) doesn't auto-forward to the new page. Instead - it decides to keep it in the same page, and put it into an iFrame sorta-thing.

    This is very annoying, so when I want to redirect www.mywebsite.com/welcome.html to www.mywebsite.com/home.html, it stays in the "welcome.html" page, but displays "home.html" in a sort-of-iframe, for some reason - I have no idea why.

    This is pretty annoying.
     
  7. BlueRevolution macrumors 603

    BlueRevolution

    Joined:
    Jul 26, 2004
    Location:
    Montreal, QC
    #7
    Using window.location should redirect the entire window, not just the frame.

    :confused:
     
  8. dylanbrown thread starter macrumors 6502

    Joined:
    Aug 20, 2008
    Location:
    London
    #8
    Nope - still opens in the same old page.
     
  9. bay2sacto macrumors member

    Joined:
    Nov 6, 2008
    #9
    You don't need to use javascript. Just need a meta refresh tag in the <head> section of the html.

    The tag you need is:
    Code:
    <meta http-equiv="refresh" content="0;url=http://example.com" />
    The number after content specifies the time until it refreshes in seconds and the url portion tells it what url to go to. So in the above example it will immediately go to example.com.

    Plus by using a meta tag instead of javascript, it wil work with users who have javascript disabled.

    Good luck.
     
  10. BlueRevolution macrumors 603

    BlueRevolution

    Joined:
    Jul 26, 2004
    Location:
    Montreal, QC
    #10
    If you notice, I mentioned that above, and the OP said that it did not work. A meta redirect certainly won't solve the frames issue.

    Try going to View -> View Source. What do you see? A whole lot of HTML or just a bit?
     
  11. dylanbrown thread starter macrumors 6502

    Joined:
    Aug 20, 2008
    Location:
    London
    #11
    All the HTML code found here that I have inserted still performs in the same page, and does not re-direct.

    As for the HTML on the page, yep - there is quite a lot - if you want me to paste a bit of it in, then please let me know.

    Is this just what iWeb does?
     

Share This Page