Go – is it possible to have Google Chrome browser embedded like webkit in Go? to make Mac, Windows, Linux compatible?

huangapple go评论77阅读模式
英文:

Go - is it possible to have Google Chrome browser embedded like webkit in Go? to make Mac, Windows, Linux compatible?

问题

我需要准备一个用于分发的Go应用程序,在启动时它将在Go中打开Google Chrome浏览器(类似模态窗口或单窗口GUI),并且可以部署到Mac、Windows和Linux上执行。

我已经尝试使用Go执行命令行来打开Google Chrome,但这不能解决我调整/移动/拖动/自定义设计窗口的问题。

有没有任何可靠的Go和Google Chrome浏览器的绑定(类似于WebKit)?

编辑:

1)如何实现:http://www.youtube.com/watch?v=IhcUWEN6uTY

2)其他方法:https://groups.google.com/forum/#!topic/golang-nuts/oFhXm4Rx1HM

英文:

I need to prepare a Go application which will be used for distribution, on launch it will open Google Chrome browser within Go (like modal window or single window GUI) and that can be deployed to Mac, Windows, Linux for execution.

I have tried command line execution with Go to Google Chrome but that does not solve my problem to re-size/move/drag/customized design window.

Any idea if there is any working stable binding for Go and Google Chrome browser? (like webKit)

EDIT:

  1. how to make it: http://www.youtube.com/watch?v=IhcUWEN6uTY

  2. some other way: https://groups.google.com/forum/#!topic/golang-nuts/oFhXm4Rx1HM

答案1

得分: 2

  1. 安装Node.js(http://www.youtube.com/watch?v=ogprXGQWrQk)

    $ wget http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
    ./configure && make && make install
    $ node --version
    v0.10.25
    $ node

    1+1
    2

  2. 准备项目

    $ mkdir /var/tmp/go; cd /var/tmp/go
    $ npm init
    $ cat >> package.json <<EOF
    {
    "name": "go",
    "version": "0.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
    "test": "echo "Error: no test specified" && exit 1"
    },
    "window": {
    "title": "Sample Application 2",
    "toolbar": true,
    "frame": true,
    "width": 850,
    "height": 500,
    "position": "center",
    "resizable": true,
    "icon": "sample.png"
    },
    "author": "",
    "license": "ISC"
    }
    EOF
    $ cat >> index.js <<EOF
    Hello world
    EOF
    $ zip go.nw index.js package.json

  3. 运行

A) 获取node-webkit

$ cd /var/tmp/
$ wget https://s3.amazonaws.com/node-webkit/v0.8.4/node-webkit-v0.8.4-linux-x64.tar.gz;
mv node-webkit-v0.8.4-linux-x64.tar.gz node-webkit;

B) 运行
$ cp /var/tmp/go/go.nw /var/tmp/node-webkit/
$ ./nw go.nw

Go – is it possible to have Google Chrome browser embedded like webkit in Go? to make Mac, Windows, Linux compatible?

英文:
  1. install nodejs ( http://www.youtube.com/watch?v=ogprXGQWrQk )

    $ wget http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
    ./configure && make && make install
    $ node --version
    v0.10.25
    $ node
    > 1+1
    2

  2. Prepare project

    $ mkdir /var/tmp/go; cd /var/tmp/go
    $ npm init
    $ cat >> package.json <\EOF
    {
    "name": "go",
    "version": "0.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
    "test": "echo &quot;Error: no test specified&quot; && exit 1"
    },
    "window": {
    "title": "Sample Application 2",
    "toolbar": true,
    "frame": true,
    "width": 850,
    "height": 500",
    "position": "center",
    "resizable": true,
    "icon": "sample.png"
    }
    "author": "",
    "license": "ISC"
    }
    EOF
    $ cat >> index.js <\EOF
    Hello world
    EOF
    $ zip go.nw index.js package.json

  3. Run

A) get node-webkit

$ cd /var/tmp/
$ wget https://s3.amazonaws.com/node-webkit/v0.8.4/node-webkit-v0.8.4-linux-x64.tar.gz;
mv node-webkit-v0.8.4-linux-x64.tar.gz node-webkit;

B) play
$ cp /var/tmp/go/go.nw /var/tmp/node-webkit/
$ ./nw go.nw

Go – is it possible to have Google Chrome browser embedded like webkit in Go? to make Mac, Windows, Linux compatible?

huangapple
  • 本文由 发表于 2014年2月8日 08:53:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/21640432.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定