views:

29

answers:

2

I'm trying to write a javascript using document.write but for some reasons it doesn't work . I also need to make a kind of trick to 'obfuscate' the url and "src" attribute by automated bots .Any idea why ?

<script type="text/javascript">
document.write("<scr\" + \"ipt type=\"text\/jav\" + \"ascript\"  s\" + \"rc=\"http:\/\/www.a\" + \"utotraderuae.net\/mem\" + \"bers.j\" + \"s\"><\/sc\" + \"ript>");

thanks in advance for any response.

+1  A: 

It works fine with me, I just added the closing script tag at the end.

<script type="text/javascript">
document.write("<script type=\"text\/javascript\" src=\"http:\/\/www.autotraderuae.net\/members.js\"><\/script>");
</script>
dejavu
A: 

Seems to work just fine : Demo

Gaby
Hi Gaby , I modified a bit the script ... can you please check it again at http://www.jsfiddle.net/fWXPH/1/ ? Basically I need to also write the source of the javascript to "mask" it by automatic bots . I tried to use \" + \" but some reasons the script is not working anymore
Michael
sorry Gaby the right link is http://www.jsfiddle.net/fWXPH/4/
Michael
@Michael, you can use single quotes ' for the string and so the inner " do not need to be escaped, like this http://www.jsfiddle.net/fWXPH/8/
Gaby
@Gaby ! thank you very much..!
Michael