Skip to content

window. child objects return undefined when using NW.js #2297

@nicklaw5

Description

@nicklaw5

I've just begun using NW.js alongside vue.js for a project. When attempting to declare vue via the node require method, I found three issues relating to the navigator, document and DocumentFragment objects, which I'm guessing relates specifically to NW.js but perhaps also other projects as well.

Each of the above object references in the vue.common.js file need to be prefixed with window.. For example:

  • window.navigator
  • window.document
  • window.DocumentFragment

Failure to do so will result in an undefined error, like this:
Uncaught ReferenceError: navigator is not defined

As @Teevio mentioned in my forum post, it would seem that NW.js only makes these variables available explicitly via the window object. This could be because NW.js provides it's own Window object, which is a wrapper of the DOM’s window object (see here).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions