SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Location
    Dubrovnik, Croatia
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE double quotes issue

    Hi to all,

    Recently i received email saying IE doesn't handle double quotes in the way other browsers do. For example

    <a href="something" title="My title saying "i like this site"">

    and this is a big issue because there is in thousand places issue like this. Is this a bug for IE and how to resolve it.


    Thank you all

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    You are supposed to escape double quotes when in a double quoted string.

    <a href="something" title="My title saying \"i like this site\"">
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    You are supposed to escape double quotes when in a double quoted string.
    Yes, but not like that.

    You have to use HTML entity references in HTML markup, not JavaScript escapes:
    Code HTML4Strict:
    <a href="something" title="My title saying &quot;I like this site&quot;">

    Of course, an even easier way is to use single quotes around the attribute value in this case,
    Code HTML4Strict:
    <a href="something" title='My title saying "I like this site"'>
    Birnam wood is come to Dunsinane

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    Yes, but not like that.
    Quite right. I must not have been properly awake when I wrote my answer.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •