• kaptkaos

    (@kaptkaos)


    Using version 2.1.3. Issue is when I try to create a page that includes javascript the & is being replaced with &. However, if I include the same code on the sidebar I do not have the problem and I get the proper info displayed.

    Example line:
    <script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/asdfwert2345/label/f1---racing?n=10&callback=GRC_p()"></script>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter kaptkaos

    (@kaptkaos)

    OK, first post and I made a couple of mistakes. The & is being replaced with &amp; is how it should have read.

    Sorry about that folks.

    Ken

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Yes, it will be replaced with &amp;, because that’s what it’s supposed to do.

    Straight ampersand symbols are actually invalid in both HTML and XHTML. Yes, even in links or scripts or img tags. They are supposed to be replaced with the &amp; text instead.

    Don’t worry, the browser will deal with it correctly.

    BTW, the fact that it’s *not* getting replaced on your sidebar is the problem here. Although it’s not necessarily a “bug”, because it’s not going through the filters that the post/page content goes through to correct these sort of things.

    You should change your sidebar to use &amp; as well, to be valid and correct.

    Thread Starter kaptkaos

    (@kaptkaos)

    Your right, I am seeing a some other thing that are getting changed. Not sure if this is supposed to happen or not.

    This is what I trying to put on the page.

    <script type="text/javascript" src="http://www.google.com/reader/ui/publisher.js"></script>
    <script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/1382752140241069/label/f1---racing?n=10&amp;callback=GRC_p(%7Bc%3A'blue'%2Ct%3A''%2Cs%3A'false'%7D)%3Bnew%20GRC"></script>

    This is what is it getting changed to.

    <script src="http://www.google.com/reader/ui/publisher.js" type="text/javascript"></script> <script src="http://www.google.com/reader/public/javascript/user/1382752140241069/label/f1---racing?n=10&amp;callback=GRC_p(%7Bc%3A\'blue\'%2Ct%3A\'\'%2Cs%3A\'false\'%7D)%3Bnew%20GRC" type="text/javascript"></script>

    In the side bar this is what code looks like now.

    <script type="text/javascript" src="http://www.google.com/reader/ui/publisher.js"></script>
    <script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/1382752140241069/label/f1---racing?n=10&amp;callback=GRC_p(%7Bc%3A'blue'%2Ct%3A'F1%20Racing%20News'%2Cs%3A'false'%7D)%3Bnew%20GRC"></script>

    The site is f1.kaptkaos.com if you want to see for yourself.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The single quotes that you’re putting in the link are getting backslash escaped, but other than that it looks like the code is basically unaltered. Find a workaround for the quote escaping. This could be a PHP setting that is causing the single quotes to be escaped.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘When creating new page with javascript amperstands being replaced with &’ is closed to new replies.