Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Error on every page #28

Open
atchavoshihnia opened this issue Jan 24, 2017 · 8 comments
Open

JS Error on every page #28

atchavoshihnia opened this issue Jan 24, 2017 · 8 comments

Comments

@atchavoshihnia
Copy link

Uncaught DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
at Object.addCSS (http://www.casamoda.com/media/exit-intent-popup/js/bioep.min.js:4:94)

@beeker1121
Copy link
Owner

Could you provide a live URL where this error happens?

It could be due to a malformed <head> tag on the page, however the script should be handling this correctly regardless.

@atchavoshihnia
Copy link
Author

atchavoshihnia commented Jan 26, 2017 via email

@beeker1121
Copy link
Owner

beeker1121 commented Jan 26, 2017

bioep_popup
bioep_popup2

Hmm, it seems to be working for me without any errors. I've attached a couple of screenshots showing the popup and errors.

I have an idea for a fix but I'm unable to replicate the error, so it would be kind of a shot in the dark. The idea is to change how the addCSS function works, so it does not try looking for a currently existing <style> element within the <head> element, but rather just appends the CSS as the last child of the <head> element.

If your page or browser/plugins do something to change the <head> tag to where the bioep script can't refer to it, then that's probably the issue. The fix then would be to append the CSS to the top of the body, but this is not within standards.

I could possibly add an option to choose where to append the CSS, either to the head or body element.

@atchavoshihnia
Copy link
Author

atchavoshihnia commented Jan 26, 2017 via email

@TolganLight
Copy link

TolganLight commented Mar 28, 2017

Hi, this issue is occurring on our site too. You can reproduce by going to https://www.intrigu.com/blogs

Note that it only happens on this one page. If you could investigate that would be great!

@tone4407
Copy link

I'm also having this issue on one page and only page only. Was there a fix?

@austinarchibald
Copy link

austinarchibald commented Sep 23, 2017

I'm also having this issue on one page. Doing A/B test with 2 landing pages. No issues on A, this error on B, and exit-intent won't work. The div just appears at the bottom of the page. Been racking by brain trying to solve this one. Perplexing.

Edit. Found my issue. It is because I had some style tags for page B that I want to override the standard css for page A. It was a lazy way to make some quick changes to page B, now I'll do it the proper way. :) The error makes sense given what it's trying to do at this line.

// Insert it before other existing style
    // elements so user CSS isn't overwritten
    document.head.insertBefore(style, document.getElementsByTagName("style")[0]);
  },

@elhenro
Copy link

elhenro commented Jun 4, 2018

This Error also prevents custom events (fe. to close on bg click, as described by maintainer on his blog, top section of comments) from functioning as expected

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

No branches or pull requests

6 participants