SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question What code can be used to make a page open half way down??

    I have some pages for which I would like to send out links. But I would like the links to be for places on my page that are not at the top... maybe half way down.

    I know this can be done, but I don't know what to call it and therefore I can't find it using Google.

    Here's one page where I'd like to use a link like that:
    http://www.health-boundaries-bite.co...rkingWell.html

    I would like the link to go to "9/15/07 Later" on the page, by the picture of the spider web.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,191
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    anchor link

    As long as the place you want to be at the top of the viewport has an Id, the URL should look like domain.com/page.html#id

  3. #3
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    Hi Mitt...

    ( I forgot the rest of the spelling of your name, I had to log in again, and the delay was long enough for me to forget)

    Right, I can imagine that what you are saying will work.

    What is the id, though...?

    Is there some html that I need to put in place?

  4. #4
    SitePoint Wizard masm50's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    2,508
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You need to use html anchor tags:
    http://www.w3schools.com/html/html_links.asp

    -Tim

  5. #5
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, that is sooooo cool!

    It took me pretty long to "get" it --- but...
    Check this out:

    http://www.health-boundaries-bite.co...l.html#spiders

    Thank you, thank you, thank you!!!!!!!!!!!!!!

  6. #6
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Can you tell me why this is?????

    Okay... I'm really confused.

    I posted my spider link here and at pbs, and if I click on that link either here or at pbs, then the page opens in the middle by the part about spiders...

    but, if I put the identical link into an email... and then click on the link when I send the email to myself... it doesn't open in the middle, it opens to the top...

    WHY is it doing that?

    I am so confused. The link is exactly the same... so why does it work here and at the pbs forum, but not in an email?????

    And, is there any way to make an anchor link work in an email?

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,191
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    anchor link in email

    AFAK, I have never experienced an anchor link in an email, so I have not experienced this behaviour. It may be that the email client strips off the end after the "#". Maybe they strip off after GET vars - "?var=val" - too?
    Hmmm. I'll have to try a few with my hotmail acount to experiment.

    EDIT:
    I just sent myself an email with
    ..../wild/search.php?fed=1
    and
    ..../music/beatles.php#bL
    links in it. Read the email with hotmail, clicked the links, the pages opened in IE (my system default) and both worked fine.

    I can't say what the problem is, but it's most likely something to do with your email client. If you have more than 1 email account, you could try it in them.

  8. #8
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Oh, that's interesting.

    Yes, it worked in Outlook Express...

    I had first used msn.

    I would sure like it to work in all email programs...

    I should try opening it in msn...

    Nope... it won't open in msn despite being sent in Outlook express...

    so do you think there's any way to make it work universally in email?

  9. #9
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,191
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    link in email

    To be honest, I have enough trouble getting things to work cross-browser, let alone cross-email-client. The only thing I can think of is that if you are sending text emails and letting the email client "auto-magically linkify" the url text you could try sending html emails with the links in mark-up. That is, instead of something like:
    Blah, blah, www.domain.com/music/beatles.php#bL blah, blah
    try:
    blah, blah, <a href='http://www.domain.com/music/beatles.php#bL'>Revolver</a>
    If you are using an email client rather than a mail script to send them, there should be some an "enter link" option of some sort in the rich text editor.

  10. #10
    SitePoint Wizard masm50's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    2,508
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The only way I can think of would be to set up a page which has a standard url ending .html which should work fine in all email clients and then do either a 301 redirect or a meta redirect to the url end #anchor.

    It's a bit of a long way round as if getting to that part of the page is so important you might as well just put that bit of info in a separate page.


    -Tim

  11. #11
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Quote Originally Posted by Mittineague View Post
    To be honest, I have enough trouble getting things to work cross-browser, let alone cross-email-client. The only thing I can think of is that if you are sending text emails and letting the email client "auto-magically linkify" the url text you could try sending html emails with the links in mark-up. That is, instead of something like:
    Blah, blah, www.domain.com/music/beatles.php#bL blah, blah
    try:
    blah, blah, <a href='http://www.domain.com/music/beatles.php#bL'>Revolver</a>
    If you are using an email client rather than a mail script to send them, there should be some an "enter link" option of some sort in the rich text editor.
    See, I don't have the knowledge to distinguish between "an email client" and "a mail script."

    I think using the mark up would detract from the conversational aspect of the email...

    I suppose I could redo my page so the part I like the most is at the top...

    which reminds me... do you think this kind of problem is also why I can't get the html for my blog to allow my title and description to be in a separate location from the rss feed image?????

    I'm at a standstill with my blog because I don't know if I could fix it if I kept at it, or if I keep at it will it just be a waste of time because the "problem" is how it was designed...????

  12. #12
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by masm50 View Post
    The only way I can think of would be to set up a page which has a standard url ending .html which should work fine in all email clients and then do either a 301 redirect or a meta redirect to the url end #anchor.

    It's a bit of a long way round as if getting to that part of the page is so important you might as well just put that bit of info in a separate page.


    -Tim
    Hi Tim,

    I didn't properly thank you for helping me with this initially. Thank you. I used the info you provided to do the anchor tag. I'm grateful to you.

    I don't know what a meta redirect is...

    I can redo my page so that the part I think is most beautiful is at the top...

    The thing is, that what I like so much is one kind of advertising picture over another... and really maybe I should leave the flowers at the top... only the ads that accompany the flowers are a little less beautiful than the coffee ads...

  13. #13
    SitePoint Wizard masm50's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    2,508
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm pleased I can help

    A meta redirect is basically using the meta refresh capabilities to redirect to another page.

    What I was thinking was that you would create another html page maybe called whatever-anchortext.html and that page would contain the following:

    Code:
    <html>
    <head>
    <title>Redirecting to ANCHOR</title>
    <META  http-equiv="refresh" content="1;URL=http://www.YOURDOMAIN.com/WHATEVER.html#ANCHOR">
    </head>
    <body bgcolor="#ffffff">
    <p>You will be redirected to ANCHOR automatically  in 1 second.</p>
    </html>
    The other option is a 301 redirect which on a standard Linux/Apache serve would mean adding a single line to the .htaccess file. In your .htaccess file just add the following line

    Code:
    redirect 301 /ANCHOR.html http://www.YOURDOMAIN.com/WHATEVER.html#ANCHOR
    Then just give the url of www.yourdomain.com/anchor.html and it should automatically go to the right page at the right point.

    Hope that works for you,

    -Tim

  14. #14
    Non-Member Consider-This's Avatar
    Join Date
    Nov 2004
    Location
    New Mexico
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by masm50 View Post
    I'm pleased I can help

    A meta redirect is basically using the meta refresh capabilities to redirect to another page.

    What I was thinking was that you would create another html page maybe called whatever-anchortext.html and that page would contain the following:

    Code:
    <html>
    <head>
    <title>Redirecting to ANCHOR</title>
    <META  http-equiv="refresh" content="1;URL=http://www.YOURDOMAIN.com/WHATEVER.html#ANCHOR">
    </head>
    <body bgcolor="#ffffff">
    <p>You will be redirected to ANCHOR automatically  in 1 second.</p>
    </html>
    The other option is a 301 redirect which on a standard Linux/Apache serve would mean adding a single line to the .htaccess file. In your .htaccess file just add the following line

    Code:
    redirect 301 /ANCHOR.html http://www.YOURDOMAIN.com/WHATEVER.html#ANCHOR
    Then just give the url of www.yourdomain.com/anchor.html and it should automatically go to the right page at the right point.

    Hope that works for you,

    -Tim
    Hi Tim,

    Boy, that's pretty clever!!!!!

    Hats off to you!

    I don't quite understand the second option... that's because I don't know what the access file is, nor where to look for it... maybe I should go search the html page and see if it is located...


  15. #15
    SitePoint Wizard masm50's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    2,508
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    On a normal linux/apache shared server setup your should find a .htaccess file in your public_html directory.

    -Tim


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
  •