node-webkit:在页面内加载自己的url实现跳转

来源:互联网 发布:网络控制器有叹号 编辑:程序博客网 时间:2024/05/29 08:37

准备工作

  1. 在nw.exe同目录下创建index.html和package.json
  2. 将下面的源码拷贝到对应文件中
  3. 将index.html和package.json打包成zip类型的文件
  4. 将zip文件拖动到nw.exe上

源码

index.html
<!DOCTYPE html><html><head>        <!-- 以下方式只是刷新不跳转到其他页面 -->        <meta http-equiv="refresh" content="10">        <!-- 以下方式定时转到其他页面 -->        <meta http-equiv="refresh" content="5;url=http://www.cnblogs.com/aszx0413/articles/1886819.html"></head><body><p>fhafkdal</p><a href="http://www.baidu.com"><input type="button">手动跳转</input></a>script跳转<script language="javascript" type="text/javascript">        // 以下方式直接跳转        window.location.href='http://www.baidu.com';        // 以下方式定时跳转        setTimeout("javascript:location.href='http://www.baidu.com'", 10);</script></body></html>
package.json
{  "name": "url-goto",  "main": "index.html"}

解释

这里写图片描述

0 0