View Full Version : use javascript to get url for facebook comments box div code

12-31-2011, 04:48 AM
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 :)

12-31-2011, 05:41 AM
Despite the similar sounding names, Java is not the same as Javascript.
Moving from Java forum to Javascript forum.