Can anybody tell me what does this script do?

Discussion in 'JavaScript' started by natalie1981, Oct 18, 2008.

  1. #1
    I've been studying the backlinks over at engadget.com and when I tried to look at their internal linking structure, I've come upon this script, it contains a link to one of their internal pages which shows up as a backlink in Google. So I was just wondering what does this script do exactly and why is it showing up as a backlink when it has no "href" html code? I'm particularly interested in the document.write('<scr' + 'ipt src since that's what's showing up as a backlink.

    Thanks in advance. :)
     
    natalie1981, Oct 18, 2008 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    Basically what this does is use document.write to make a script that CALLS another script.

    If you do

    <script src="/linkto/yourscript.js" type="text/javascript"></script> it will load another javascript. That's basically all that document.write is doing - even inside script tags opening <script> will close the script tag prematurely, to prevent this this is using the common 'trick' of breaking up "<script>" into "<scr"+"ipt" - so the browser doesn't see that as a script tag while running the embedded script, but WILL see it as a script tag after it's been written to the page (and run it)

    The rest of that is just browser sniffing/tracking info being sent to the script the document.write is calling.
     
    deathshadow, Oct 19, 2008 IP
  3. natalie1981

    natalie1981 Active Member

    Messages:
    303
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks. So if it's calling out another script why is it showing up as a Google backlink even without the "href" tag? Oh, and does anyone know what kind of tracking script it is or could you suggest a similar script that allows Google to read it as a link to the site?
     
    natalie1981, Oct 19, 2008 IP