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

Open url in a new tab? #5

Open
pratapsu opened this issue Aug 8, 2018 · 2 comments
Open

Open url in a new tab? #5

pratapsu opened this issue Aug 8, 2018 · 2 comments

Comments

@pratapsu
Copy link

pratapsu commented Aug 8, 2018

Marwan:

router.Redirect() opens the new url in the same window. Do you have any advice for opening the url in a new tab, or even in a new window?

Thanks,

Pratap

@marwan-at-work
Copy link
Owner

marwan-at-work commented Aug 10, 2018

@pratapsu thanks for opening the issue. If JavaScript can do it, then GopherJS can as well. I haven't looked at the JavaScript API for that particular part but I'd be happy to accept a PR, otherwise I'll probably look at this in the next couple of weeks. Thanks!

@pratapsu
Copy link
Author

I was able to modify Redirect() slightly to open a new window for the URL. But, the window contents would not render. (they would if I did what you do in Redirect()).

Here is the code I wrote:

func RedirectToNewWindow(route string) {
	js.Global.Call("open",
		route,
		"_blank",
	)
	refreshRoutes()
}

I haven't figured out yet how to have vecty actually render the page when I click on the URL.
Thanks for looking into this. I'll be happy to hear what you learn.

Pratap

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