SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Ampersand Validation Problem

    Hi,

    I've recently added some banners to my site (http://www.unitedonline.co.uk) which are provided by a third party affiliate company. These contained "&" symbols which I've replaced with "&" so that my code still validates.

    However once the page is uploaded the browser converts this back to "&" which then causes my page to fail html validation

    For example:

    My code
    Code:
    <a href="http://www.awin1.com/awclick.php?mid=550&amp;linkid=26952&amp;id=57153" title="Firebox (opens in new window)" target="_blank">
    <img src="http://www.awin1.com/show.php?mid=550&amp;linkid=26952&amp;aid=57153" alt="Firebox Advert" style="border: 0px;" />
    </a>
    Browser generated code
    Code:
    <a href="http://www.awin1.com/awclick.php?mid=550&linkid=26952&id=57153" title="Firebox (opens in new window)" target="_blank">
    <img src="http://www.awin1.com/show.php?mid=550&linkid=26952&aid=57153" alt="Firebox Advert" style="border: 0px;" />
    </a>
    Surely there must be a simple solution to this or something that I'm missing?

    Any help would be much appreciated as it's driving me insane because the rest of the page validates fine.

  2. #2
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is creating the incorrect banners - the third-party? There's not a lot you can do about that (apart from drop the advertising) - you'll just have to live with invalid pages.

  3. #3
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The third party are creating the incorrect banners but it is code I paste on my site so I have changed it to the correct "&amp;" but when looking at it in a browser it seems to have reverted back to an "&"

  4. #4
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well &amp; will look like & in a webpage you did the right thing and the page(s) should now validate

  5. #5
    I am obstructing justice. bronze trophy fatnewt's Avatar
    Join Date
    Jul 2002
    Location
    Ottawa, Canada
    Posts
    1,766
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does it look like an & or &amp; when you view the source on the page?
    Colin Temple [twitter: @cailean]
    Web Analyst at Napkyn


  6. #6
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can we see it?

  7. #7
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fatnewt
    Does it look like an & or &amp; when you view the source on the page?
    It looks like an & when I view the source once the page has been rendered online and not an &amp;

    However the code I'm uploading to my server is definitely valid and uses &amp's so there's obviously something strange going on serverside. Any ideas?

    Quote Originally Posted by BonRouge
    Can we see it?
    Yeah sure. It's on the homepage of http://www.unitedonline.co.uk

  8. #8
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Surreal...
    I don't know why it's doing that, but I have an idea...
    Why not use tinyurl.com ?

  9. #9
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BonRouge
    Surreal...
    I don't know why it's doing that, but I have an idea...
    Why not use tinyurl.com ?
    I don't think tinyurl.com would work because it requires those parameters in the url in order to record the number of referals and sales coming from my site aswell as which banner to display and therefore the url cannot change other than changing the &'s to &amp's which I have done.

    Keep the suggestions coming though but I'm starting to think that this is more than just an xhtml issue and probably something to do with the setup of the server? []

  10. #10
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    When I viewed the source of the main page I saw mostly &amp;'s but there were still a few &'s, mainly in url's.

  11. #11
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps your server is replacing &amp; with &? Try with &amp;amp;.
    Simon Pieters

  12. #12
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zcorpan
    Perhaps your server is replacing &amp; with &? Try with &amp;amp;.
    That's great, worked a treat!! I'm suprised no-one else has had this problem before though, a work collegue has had exactly the same problem and has his sites hosted with another company so sure this is a common problem.

    Thanks for the help.

  13. #13
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by csswiz
    I'm suprised no-one else has had this problem before though
    http://www.sitepoint.com/forums/show...26amp%3Bamp%3B
    Simon Pieters


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
  •