PDA

View Full Version : codes like javascript:.....void(0) in address bar, browser dependency problem



abduraooft
Mar 1st, 2007, 02:51 PM
I've been serching for javascripts which when copied to the address bar and pressed enter key, will result in to some beautiful effects to the content of the document such as image rotation, resize etc.

Now i've got a code which is for rotating the entire document content.
It works for almost all websites, with an exception of google products in IE
But it will work if you are viewing gmail,orkut or even google in Mozilla

IE doesn't show any errors, but its not working
check this

javascript:x=0;e=document.body;e.style.position="relative";function rt() {e.style.top=100-(50*Math.cos(x*Math.PI/180))+"px";e.style.left=100+(50*Math.sin(x*Math.PI /180))+"px";x+=5; }setInterval("rt()",50);void(0);

paste in to your url (try for differnt sites)

Why its not woking for Google pages

Arty Effem
Mar 1st, 2007, 05:26 PM
I've been serching for javascripts which when copied to the address bar and pressed enter key, will result in to some beautiful effects to the content of the document such as image rotation, resize etc.

Now i've got a code which is for rotating the entire document content.
It works for almost all websites, with an exception of google products in IE
But it will work if you are viewing gmail,orkut or even google in Mozilla

IE doesn't show any errors, but its not working
check this

javascript:x=0;e=document.body;e.style.position="relative";function rt() {e.style.top=100-(50*Math.cos(x*Math.PI/180))+"px";e.style.left=100+(50*Math.sin(x*Math.PI /180))+"px";x+=5; }setInterval("rt()",50);void(0);

paste in to your url (try for differnt sites)

Why its not woking for Google pagesNo doctype....

abduraooft
Mar 2nd, 2007, 06:14 AM
No doctype....

Could you please explain a little more.....

chump2877
Mar 2nd, 2007, 06:44 AM
www.google.com (http://www.google.com) doesn;t have a DOCTYPE....for example:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

If you add a DOCTYPE and the javascript to the browser source for that page, it works in IE (works in IE 7, didn;t test in IE 6)...run the following code in IE:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html lang=en>

<meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><style><!--
body,td,a,p,.h{font-family:arial,sans-serif}
.h{font-size:20px}
.h{color:#3366cc}
.q{color:#00c}
--></style>
<script>
<!--
function sf(){document.f.q.focus();}
window.clk=function(b,c,d,h,i,j){if(document.images){var a=window.encodeURIComponent?encodeURIComponent:escape,e="",f="",g="";if(b){e="&url="+a(b.replace(/#.*/,"")).replace(/\+/g,"%2B")}if(c){f="&oi="+a(c)}if(d){g="&cad="+a(d)}(new Image).src="/url?sa=T"+f+g+"&ct="+a(h)+"&cd="+a(i)+e+"&ei=ZcXnRY3_G5HS-QKp9a3iCQ"+j}return true};// -->
</script>
</head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="sf();if(document.images){new Image().src='/images/nav_logo.png'}" topmargin=3 marginheight=3><center><div align=right nowrap style="padding-bottom:4px" width=100%><font size=-1><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den&usg=__yvmOvIrk79QYmDkrJAeuYO8jTmo=" onmousedown="return clk('/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den&usg=__yvmOvIrk79QYmDkrJAeuYO8jTmo=','promos','hppphnu:def','pro','1','')">Personalize this page</a>&nbsp;|&nbsp;<a href="https://www.google.com/accounts/Login?continue=http://www.google.com/&hl=en">Sign in</a></font></div><img alt="Google" height=110 src="/intl/en_ALL/images/logo.gif" width=276><br><br><form action="/search" name=f><script defer><!--
function qs(el){if(window.RegExp&&window.encodeURIComponent){var ue=el.href,qe=encodeURIComponent(document.f.q.value);if(ue.indexOf("q=")!=-1){el.href=ue.replace(new RegExp("q=[^&$]*"),"q="+qe);}else{el.href=ue+"&q="+qe;}}return 1;}
function togDisp(e){stopB(e);var elems=document.getElementsByName('more');for(var i=0;i<elems.length;i++){var obj=elems[i],dp="";if(obj.style.display==""){dp="none";}obj.style.display=dp;}return false;}
function stopB(e){if(!e)e=window.event;e.cancelBubble=true;}
document.onclick=function(event){var elems=document.getElementsByName('more');if(elems[0].style.display==""){togDisp(event);}}
//-->
</script><table border=0 cellspacing=0 cellpadding=4><tr><td nowrap><font size=-1><b>Web</b>&nbsp;&nbsp;&nbsp;&nbsp;<a class=q href="http://images.google.com/imghp?ie=UTF-8&oe=UTF-8&hl=en&tab=wi" onclick="return qs(this)">Images</a>&nbsp;&nbsp;&nbsp;&nbsp;<a class=q href="http://video.google.com/?ie=UTF-8&oe=UTF-8&hl=en&tab=wv" onclick="return qs(this)">Video</a>&nbsp;&nbsp;&nbsp;&nbsp;<a class=q href="http://news.google.com/nwshp?ie=UTF-8&oe=UTF-8&hl=en&tab=wn" onclick="return qs(this)">News</a>&nbsp;&nbsp;&nbsp;&nbsp;<a class=q href="http://maps.google.com/maps?ie=UTF-8&oe=UTF-8&hl=en&tab=wl" onclick="return qs(this)">Maps</a>&nbsp;&nbsp;&nbsp;&nbsp;<b><a href="/intl/en/options/" class=q onclick="this.blur();return togDisp(event)">more&nbsp;&raquo;</a></b><span name=more id=more style="display:none;position:absolute;background:#fff;border:1px solid #369;margin:-.5ex 2ex;padding:0 0 .5ex .8ex;width:16ex;line-height:1.9;z-index:1000" onclick="stopB(event)"><a href=# onclick="return togDisp(event)"><img border=0 src=/images/x2.gif width=12 height=12 alt="Close menu" align=right hspace=4 vspace=4></a><a class=q href="http://blogsearch.google.com/?ie=UTF-8&oe=UTF-8&hl=en&tab=wb" onclick="return qs(this)">Blogs</a><br><a class=q href="http://books.google.com/bkshp?ie=UTF-8&oe=UTF-8&hl=en&tab=wp" onclick="return qs(this)">Books</a><br><a class=q href="http://froogle.google.com/frghp?ie=UTF-8&oe=UTF-8&hl=en&tab=wf" onclick="return qs(this)">Froogle</a><br><a class=q href="http://groups.google.com/grphp?ie=UTF-8&oe=UTF-8&hl=en&tab=wg" onclick="return qs(this)">Groups</a><br><a class=q href="http://www.google.com/ptshp?ie=UTF-8&oe=UTF-8&hl=en&tab=wt" onclick="return qs(this)">Patents</a><br><a href="/intl/en/options/" class=q><b>even more &raquo;</b></a></span></font></td></tr></table><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input maxlength=2048 name=q size=55 title="Google Search" value=""><br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25%><font size=-2>&nbsp;&nbsp;<a href=/advanced_search?hl=en>Advanced Search</a><br>&nbsp;&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&nbsp;<a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><br><font size=-1><a href="/intl/en/ads/">Advertising&nbsp;Programs</a> - <a href=/services/>Business Solutions</a> - <a href=/intl/en/about.html>About Google</a><span id=hp style="behavior:url(#default#homepage)"></span><script><!--
(function() {var a="http://www.google.com/",b=document.getElementById("hp"),c=b.isHomePage(a);if(!c){document.write('<p><a href=/mgyhp.html onClick=document.getElementById("hp").setHomepage("'+a+'")>Make Google Your Homepage!</a>')};})();//-->
</script></font><p><font size=-2>&copy;2007 Google</font></p></center>

<script type="text/javascript">

x=0;e=document.body;e.style.position="relative";function rt() {e.style.top=100-(50*Math.cos(x*Math.PI/180))+"px";e.style.left=100+(50*Math.sin(x*Math.PI /180))+"px";x+=5; }setInterval("rt()",50);void(0);

</script>
</body></html>

abduraooft
Mar 3rd, 2007, 10:37 AM
Many thanks RJ...

But its working in both Mozilla and opera for google !

Why its so?

Or can I add or change the doctype of a document by executing something in address bar ?

regards,
art

abduraooft
Mar 5th, 2007, 06:20 AM
i'm really curious to know about this abnormality

chump2877
Mar 5th, 2007, 07:57 AM
But its working in both Mozilla and opera for google !

Why its so?I don't really know...Different browsers react differently to the absence of a doctype...the reactions are pretty much unpredictable....

Th important thing to know is that with a doctype, your code will/should work as expected in different browsers...This is why you should always use a doctype in your X/HTML files....


Or can I add or change the doctype of a document by executing something in address bar ?Again, I don't know...I've honestly never tried it...Maybe you can dynamically append a text node (with the doctype in it) to the DOM (by adding to the javascript you already have)

Can I ask you a question? This code is useless beyond a few moments of marginal entertainment....Why do you need this code to work?

abduraooft
Mar 5th, 2007, 08:30 AM
Can I ask you a question? This code is useless beyond a few moments of marginal entertainment....Why do you need this code to work?

Since you have given a honest reply I should also be honest..

Its for me to share all my friends in orkut so that they can also enjoy for a few moment.. thats all.

Below one script surprized really on execution from address bar

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

So, I'm searching for such items that reveals the power of javascript

thanks n regards,
art