Jump to content

how to encapsulate ampersands in link? (target rejects &amp


thesoundsmith

Recommended Posts

I'm trying to send a link extracted from an XML playlist. A tyical list item looks like this:

{ file: "wavs/rhino/1-loveisblind.mp3" ,image: "pix/rhinette_LRG.jpg",title: "Love Is Blind",description: "Rhinoblossom",link: "private/zcart/index.php?main_page=product_music_info&cPath=62&products_id=242" },

I return the link by clicking a button:

<a id="btn4"class="button3"title="Buy this Song"onclick="window.open(jwplayer(container).getPlaylistItem().link);"></a>

This works perfectly; the user clicks and the link is followed to a ZenCart page. But it does not pass w3c, the ampersands need to be converted to &

{ file: "wavs/rhino/1-loveisblind.mp3" ,image: "pix/rhinette_LRG.jpg",title: "Love Is Blind",description: "Rhinoblossom",link: "private/zcart/index.php?main_page=product_music_info&cPath=62&products_id=242" },

The problem is, the ZenCart responds with a "blank" page(my site header and sidebar options, but no content, even though it displays the apparent identical address.) I can change either the link or the javascript call, but how can I best encapsulate the link so it works correctly and passes w3c? I tried single quotes, link: "private/zc... but they become part of the link address and resulted in "page not found." The working page is at http://www.thesounds...com/radiopg.htm and the one that passes w3c but fails the link is http://www.thesounds...om/radiopg2.htm Any ideas greatly appreciated.

Link to comment
Share on other sites

Thanks. I tried all the variations, using %26 at least got a genuine error message from ZenCart, the other &amp both with and without a semicolon at the end result in a blank ZenCart page.

Edited by The Soundsmith
Link to comment
Share on other sites

Are you aware that the only reason your page fails to validate is because you are using an xhtml doctype? If you change the doctype to HTML5, this error disappears.

<!DOCTYPE html><html>

Link to comment
Share on other sites

Really? I had NO idea. Too much stuff to keep up with. I'll try it, thanks hugely. (Didn't even realize there WAS an HTML5 doctype...) And it WORKS! Thanks!

Edited by The Soundsmith
Link to comment
Share on other sites

Deirdre's Dad, quick question: Now w3c doesn't like the closing characters in my meta refs. I just changed the DOCTYPE to HTML5 and now get these errors: Bad value keywords for attribute http-equiv on element meta. andBad value keywords for attribute http-equiv on element meta. "... smooth iOS" /> points to the ">" character as source of the error. What is the fix? And/or a link to (simple-to-understand, please) what is different in that doctypeThanks.

Link to comment
Share on other sites

You have 3 meta tags with an http-equiv attribute. This corresponds to an HTTP header. You are expected to pass the value of a recognized HTTP header. In your third one, you do. That's the Content-Type. In the first two, you don't. Maybe you originally copy/pasted that stuff from somewhere. Anyway, where the values are "description" or "keywords", change the attribute from http-equiv to name. That should fix it. The doctype thing is simple. XHTML follows the rules of XML. HTML doesn't have to. Those are the rules you were breaking. The C-Data fix dsonesuk pointed out would have handled it, but I realized you were basically conforming to HTML5 anyway, so it seemed simpler to move you to that.

Link to comment
Share on other sites

Thanks, DD. And yes, those were headers from the 2008 update to css that I have not altered except for the last couple values,.Got it all compatible now, thanks. HTML "doesn't have to?" Interesting... :-)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...