Maybe Lao Zhao is disgusted with IE6, so he made some tricks in his blog. If IE6 browses his blog, it will jump to another page.
I am very depressed. Do I need to install a browser to read a blog? I'm very lazy, I just want to use IE6 to watch it!
I was reading jQuery recently. I just got started and found an interesting function, so I experimented with it on Lao Zhao’s blog, haha.
Loads the latest version of an HTML web page.
jQuery code:
$.ajax({
url: "test.html",
cache: false,
success: function(html){
$("#results").append(html);
}
});
<div id="results"></div>
Just use this, change the address to Lao Zhao’s blog and see what effect it will have, hehe.
Create a new text file and rename it: a.htm. Just copy the code in the example, change the URL, and run it.
I saw it, ha, wait, why did it jump again? It seems that the js script in the blog is also running. Look, wouldn’t it be ok if I killed that script?
After searching for a long time (js is relatively bad), I finally found it.
code
<!--[if IE 6]>
<script language="javascript" type="text/javascript">
var url = window.location.toString();
window.location = " http://files.cnblogs.com/JeffreyZhao/no-ie6.xml?r =" + Math.random().toString() + "&from=" + encodeURIComponent(url);
</script>
<![endif]-->
This is the code that is causing trouble, kill it. Just replace "window.location..."
code
<head><title>Use IE6 to read Lao Zhao’s blog v1.0</title>
<script src="aspnet_client/jquery/jquery-1.3.1.js" type="text/javascript"></script>
<script type="text/javascript">
//Wait for the dom element to be loaded.
$(document).ready(function(){
$.ajax({
url: " http://www.cnblogs.com/JeffreyZhao/archive/2010/01/14/talk-about-code-performance-4-asm-optimization.html ",
cache: false,
success: function(html){
html = html.replace("window.location = " http://files.cnblogs.com/JeffreyZhao/no-ie6.xml?r= " + Math.random().toString() + "&from= " + encodeURIComponent(url);","");
$("#results").append(html);
}
});
});
</script>
</head>
<body>
<div id="results"></div>
</body>
</html>
This is the code. Create a text file locally, rename it, copy it, and run it. Then you can see Lao Zhao's blog in IE6.
ps: When I run this code on the website, it says "no permissions". Therefore, online demonstration is not possible.