aardio 文档

aardio 范例:弹窗/文件拖放

//禁止弹窗
import win.ui;
/*DSG{{*/
var winform = win.form(text="禁止弹窗";right=818;bottom=507)
winform.add()
/*}}*/

import web.view; 
var wb = web.view(winform);

//弹出新窗口触发
wb.onNewWindow = function(url){

    //耗时操作应返回异步自动执行的函数(提前结束 onNewWindow)
    return function(){ 
        //如果打开的是 file: 前缀网址,例如拖放文件到网页上。
        var filePath = inet.url.getFilePath(url)
        if(filePath){
            winform.msgbox(filePath,"本地文件");    
        }
        else {
            wb.go(url); 
        } 
    }
}

wb.html = /**
<!doctype html>
<html><head><base target="_blank" /></head>
<body style="margin:50px">
<a href="http://www.aardio.com"  ><span><span>aardio.com</span></span></a>
<button onclick="window.open('http://www.aardio.com')" >aardio.com</button>
**/

winform.show();
win.loopMessage();

Markdown 格式