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

hrefs don't navigate #244

Open
sashton opened this issue Jan 3, 2016 · 3 comments
Open

hrefs don't navigate #244

sashton opened this issue Jan 3, 2016 · 3 comments

Comments

@sashton
Copy link

sashton commented Jan 3, 2016

I've tried adding an href to HtmlView output. The link renders, but on clicking it, the browser doesn't navigate. Is there some global click handler which is preventing it?

Example:

#gorilla_repl.html.HtmlView{:content ("<a href=\"http://www.google.com\">www.google.com</a>")}
@sashton
Copy link
Author

sashton commented Jan 4, 2016

On investigation, it looks like my suspicion is confirmed: https://github.com/JonyEpsilon/gorilla-repl/blob/develop/resources/gorilla-repl-client/js/renderer.js#L20

The event listener there is returning false. Maybe a solution would be to return false if alt is pressed, but true if otherwise, to allow normal href behavior to occur.

As a workaround, I added an ugly javascript onclick handler to get the navigation to happen:

#gorilla_repl.html.HtmlView{:content ("<a href=\"http://www.google.com\" onclick=\"window.open('http://www.google.com');\">google</a>")}

@JonyEpsilon
Copy link
Owner

This was done to stop the case where you click on a link and then lose your unsaved work in Gorilla, which is very annoying!

Having a modifier that allows you to follow the link (a bit like in MS Word) is a nice idea.

@sashton
Copy link
Author

sashton commented Feb 24, 2016

Keeping unsaved work is definitely a good idea. In my snippet above I solved that by opening the link in a new browser window.

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

No branches or pull requests

2 participants