Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

window is not defined in vue #414

Closed
warrebuysse opened this issue Mar 13, 2017 · 4 comments
Closed

window is not defined in vue #414

warrebuysse opened this issue Mar 13, 2017 · 4 comments

Comments

@warrebuysse
Copy link

warrebuysse commented Mar 13, 2017

<template>
  <div ref="globalfooter">
    <div id="global-footer"></div>
  </div>
</template>

<script>

import postscribe from 'postscribe'

  export default {
    name: 'global-footer',
    mounted () {
      postscribe('#global-footer', '<script src="//widgets-dev.hbplus.be/widget/live/70f9c938e7d94f4796131909296812c4"><\/script>')
    }
  }
</script>

Trying to use postscribe inside a Vue component but I keep hitting into the same "window is not defined" issue. Are there any hands-on examples with vue and postscribe?

@jnewman
Copy link
Contributor

jnewman commented May 11, 2017

I don't think so. I'm thinking you'll need to build an adapter if you need special functionality for vue

@jnewman jnewman closed this as completed May 11, 2017
@rwsabhishek
Copy link

I am facing the same issue with react/next js
image

So to resolve this for now, I have to edit the node module postscribe.js file and add following conditions in line 1335.
image
var work={}; if (typeof window !== "undefined") work = window.document.createElement('div');
Please help me as how can i resolve this issue.
Or it will be helpful if you add this condition at your module. So i will use the latest version

@jnewman
Copy link
Contributor

jnewman commented Oct 31, 2022

@rwsabhishek I'd open a new issue, this one's been closed for >5yrs (I'm no longer part of this project).

@rwsabhishek
Copy link

@rwsabhishek I'd open a new issue, this one's been closed for >5yrs (I'm no longer part of this project).

Hello @jnewman ,my only suggestion here is to add the window check condition to the postscribe.js file and launch the new module version. So i can install the package

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants