<!doctype html>
<html>
<head>
<title>page</title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
<script>
function goToPage() {
var pageUrl = 'http://www.google.com/';
window.open(pageUrl);
}
</script>
<div id="installBtn" onclick="goToPage()">go to page</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
预期的操作是:当触摸div时,将打开一个新窗口.此代码在iPhone的Safari中非常有用.
但是,当我点击"+" - >"添加到主屏幕",然后按"转到页面"时,不会打开任何窗口,并且页面会加载到同一屏幕中.
如何通过javascript强制在独立模式下打开一个新窗口?
javascript iphone web-applications mobile-safari iphone-standalone-web-app
我有一个BufferedImage对象,我想将其编码为BMP格式并将其保存到磁盘.
我该怎么做呢?
在JPEG它没关系:
BufferedImage img; //here is an image ready to be recorded into the hard disk
FileOutputStream fout = new FileOutputStream("image.jpg");
JPEGImageEncoder jencoder = JPEGCodec.createJPEGEncoder(fout);
JPEGEncodeParam enParam = jencoder.getDefaultJPEGEncodeParam(img);
enParam.setQuality(1.0F, true);
jencoder.setJPEGEncodeParam(enParam);
jencoder.encode(img);
fout.close();
Run Code Online (Sandbox Code Playgroud)