Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Thanked 0 Times in 0 Posts

    use javascript to get url for facebook comments box div code

    I have the two following code snips im working with...

    <script type="text/javascript">
    var url=document.location.href;

    & the facebook comments box code:

    <div class="fb-comments" data-href="url" data-num-posts="20" data-width="550" data-colorscheme="dark"></div>

    I for the life of me cant figure out how to get the variable "url" into the href for the FB comment box. I'd like to do this so no matter what page the complete code is placed on it knows what page to associate the box with, without individual page editing. I'm new to javascript and can generally do some research and figure out what im doig but this has me baffled :| If anyone has the answer it would be GREATLY appreciated!! Thanks in advance :)
    Last edited by enlil; 12-31-2011 at 04:51 AM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,662 Times in 2,631 Posts
    Despite the similar sounding names, Java is not the same as Javascript.
    Moving from Java forum to Javascript forum.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts