PDA

View Full Version : Basic Script Question



mynameisryan
06-15-2013, 12:03 AM
I know very little about javascript and coding in general, which is why I'm here. This is probably a very simple question:

While I was on Dailymotion.com (Youtube-like site), I noticed that every other video (or so) had a random script across the top of the page that was some variation of


document.getElementByld('fb-root').appendChild(e);}}();
OR simpy


fb-root').appendChild(e);}}());

I'm just wondering if this is bleeding over from sloppy scripting, or if this is some reason for concern. Is this trying to inform me of something, or is it just a mistake on the part of Dailymotion?

From what I've read so far, I assume this is a relatively common command for java/javascript. I'm just wondering what it's doing at the top of the webpage. According to google, the "fb-root" has something to do with Facebook.

Thanks everyone!

mod's edit

Hi mynameisryan, welcome to DynamicDrive!

In the future, do not cross-post (do not post more than one thread on the same topic). This only creates confusion.
In many cases -especially since these are your first posts- it also makes us (the mods) think you're a spammer, and can get you banned pretty easily.

In the meantime, I have deleted your other thread. This is the appropriate forum, since this is a javascript (not java) question.

Also,Please use the forum's bbcode tags and indent your code to make it more readable:

for php code............
<?php /* code goes here */ ?>
for html...............
<!-- markup goes here -->.....
for js/css/other.......
code goes here................
I've made these changes for you in your first post.

jscheuer1
06-15-2013, 01:53 AM
What browser and what version of that browser on what OS and what version of that OS?

And do you mean that you see it on the page, or in source view?

It's true that there is code like that in the source code of their home page. But it's javascript, so you shouldn't be seeing it. If you are, perhaps your browser has javascript disabled, or you have a bad connection and the file is corrupted during transmission.

On the other hand, if you mean you see it in the source code, yes it's there as part of a script that allows you to interact with the page visa vis FaceBook, presumably as to whether you want to Like or Dislike the page and/or a given video on it.