本文主要总结了一些线上文档的实用技术,后面陆续会根据实际需求将不一样的技术进行分类或者归到兼容文档里。javascript
方案:oncontextmenu=”window.event.returnValue=false”html
方案:onselectstart=”return false”前端
方案:onpaste=”return false”java
方案:oncopy=”return false;” oncut=”return false;”web
方案:< link rel=”Bookmark” href=”favicon.ico”>ajax
方案:< input style=”ime-mode:disabled”>浏览器
方案:缓存
< script >
if (top.location != self.location)top.location=self.location;
< /script>
复制代码
方案:< noscript>< iframe src=*.html>< /iframe>< /noscript>bash
方案:< input type=button value=查看网页源代码 onclick=”window.location = “view-source:”+ “www.pconline.com.cn””>服务器
方案:
< script language=”javascript”>
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart(“character”,e.value.length);
r.collapse(true);
r.select();
}
< /script>
< input type=text name=text1 value=”123″ onfocus=”cc()”>
复制代码
方案:
< META HTTP-EQUIV=”pragma” CONTENT=”no-cache”>
< META HTTP-EQUIV=”Cache-Control” CONTENT=”no-cache, must-revalidate”>
< META HTTP-EQUIV=”expires” CONTENT=”Wed, 26 Feb 1997 08:21:57 GMT”>
或者< META HTTP-EQUIV=”expires” CONTENT=”0″>
复制代码
方案:< a href=”#” onFocus=”this.blur()”>< img src=”logo.jpg” border=0>< /a>
方案:
< body onload=”top.resizeTo(300,200);”>
//打开页面的位置
< body onload=”top.moveBy(300,200);”>
复制代码
方案:< input onkeydown=”if(event.keyCode==13)event.keyCode=9″>
方案: auto :标准光标 ;default :标准箭头 ; hand :手形光标; wait :等待光标; text :I 形光标; vertical-text :水平; I 形光标; no-drop :不可拖动光标 ; not-allowed :无效光标 ; help :?帮助光标 ; all-scroll :三角方向标; move :移动标; crosshair :十字标;其余: e-resize n-resize nw-resize w-resize s-resize se-resize sw-resize
方案:< META http-equiv=V=”REFRESH” content=”5;URL=http://www.51js.com”>
方案:oncontextmenu=”window.event.returnValue=false”
解析:在获取属性,ajax请求,事件坐标,透明的写法,阻止冒泡等均是不一样的。 参考资料:ie与其余浏览器区别
方案:text-indent 能够实现文本的缩进
方案:oncontextmenu=”window.event.returnValue=false”
方案:参考代码
public void createPdf() throws Exception {
// step 1
String inputFile = "index.html";
String url = new File(inputFile).toURI().toURL().toString();
String outputFile = "index.pdf";
System.out.println(url);
// step 2
OutputStream os = new FileOutputStream(outputFile);
org.xhtmlrenderer.pdf.ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(url);
// step 3 解决中文支持
org.xhtmlrenderer.pdf.ITextFontResolver fontResolver = renderer
.getFontResolver();
fontResolver.addFont("c:/Windows/Fonts/simsun.ttc", BaseFont.IDENTITY_H,
BaseFont.NOT_EMBEDDED);
renderer.layout();
renderer.createPDF(os);
os.close();
System.out.println("create pdf done!!");
}
复制代码
你们在使用原始方式载入脚本或者样式文件的时候,通常cdn的建议方式是https的,但咱们的应用协议不必定是https的,这种时候使用// ,会自动识别当前页面适合的协议,若是你强行使用https就会报错或者很慢