As will soon become obvious, I don't know javascript and need help with this code. At fcdrycreek.com, which is an old-style 3-frame site, I put a "Facebook Share" link in the "title" frame with this javascript: ---------- <script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script> <img src="images/title-up.gif" name="title" width="800" height="94" border="0" usemap="#titleMap" id="title"> <a href="javascript:;"> <map name="titleMap"> <area shape="rect" coords="629,10,760,89" href="fc.htm" target="mainFrame"> <area shape="rect" coords="6,32,41,81" href="http://www.facebook.com/share.php?u=http://www.fcdrycreek.com/index.htm" onclick="return fbs_click()" target="_blank" rel="nofollow" > </map> </a> ---------- When the Facebook "Share This Link" popup appears, the link "www.fcdrycreek.com/title.htm" is included but I want just the domain "www.fcdrycreek.com" to be listed.How do I do that? Thanks ahead.
Well.. your code makes no sense whatsoever... an anchor wrapping a image map?!? That anchor ALONE may be overriding the ability to even click on the map areas since it would take priority. Of course using attributes like target and javascript to fake target ... isn't just bad practice, it wouldn't gracefully degrade well either. You figure in things like the NAME attribute on tags that don't have names, attributes like BORDER and TARGET="_blank" that have no business on any website made after 1998, things like window.open that are blocked by default in many modern browsers and disabled by users on purpose in others... Of course that it's working inside framesets means... yeah, that's old alright. So old it should be thrown away and done over as, well... as I often tell people, there's little if anything worth even TRYING to save from that train wreck of outdated code and inaccessible design practices... what with the frames, tables for layout, non-semantic markup, and needlessly/pointlessly complex code... much less the endless pointless javascript that's either serving no legitimate purpose or is wasting time to try and do things client-side that really belong on the server.
Well, it's your business how you code your site and don't take deathshadow's rant too personally. However, you might want to switch to more modern tech and avoid a boat load of SEO issues, plus eliminate problems like you're having now, by using a CMS such as Wordpress. (There are a lot of plugins to set up Facebook functionality for you without the need to hand code them.) Anyway, as for your problem. You're clicking on the link from within title.htm, so that's why it is sharing that page instead of just www.fcdrycreek.com, so in the JavaScript function fbs_click() you need to tell it specifically which URL to share and with which title. Instead of: u=location.href;t=document.title; HTML: try: u="http://www.fcdrycreek.com";t="whatever title you prefer"; HTML:
ryan_uk, Thanks so much your reply and for your help. Yes, I know the site needs updating but, for now, it is out of my control. (In fact, plans are already in place to move to a WordPress site). For the time being, I am trying to work with what is there. Thanks again for HELPING and providing USEFUL advice.
You're welcome. I wish you all the best with that. I've migrated HTML and Blosxom sites to Wordpress before and found it very straightforward. I'm sure you can get advice here or Wordpress.org if you encounter any problems migrating it.