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

target="_blank" does not open new tab #40

Closed
zackhitch opened this issue Apr 17, 2019 · 3 comments
Closed

target="_blank" does not open new tab #40

zackhitch opened this issue Apr 17, 2019 · 3 comments

Comments

@zackhitch
Copy link

<Obfuscate
  element="a"
  href="https://www.google.com"
  target="_blank"
  style={{
    textAlign: "left",
  }}
>
  Click Here
</Obfuscate>

Having target="_blank" does not open a new tab, but instead directs current window to the href.

@zackhitch
Copy link
Author

This happens when just using the href prop as well, (and not a custom element prop`

@coston
Copy link
Owner

coston commented Apr 17, 2019

Hey Zack! Thank you for creating this issue.
The href prop is super new, so I haven't run into this issue yet. Currently onClick links are created using window.location.href. In #41 I allow for regular html link functionality to occur if the link is interacted with by focus or mouseover. Thus, allowing for target="_blank" to work.

For regular href or other links with contact props (e.g. email), you may leave out the element and style props. The code below should work for most cases.

<Obfuscate href="https://www.google.com" target="_blank">Click Here</Obfuscate>

#41 is available to try now with npm i react-obfuscate@next. Please let me know what you think about this solution!

@coston
Copy link
Owner

coston commented Apr 18, 2019

#41 is merged and available at npm i react-obfuscate@3.5.0

@coston coston closed this as completed Apr 18, 2019
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

2 participants