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

Strips querystring from URL if it precedes with # in Windows 10 - Chrome #17

Closed
codef0rmer opened this issue Sep 19, 2015 · 11 comments · Fixed by #146
Closed

Strips querystring from URL if it precedes with # in Windows 10 - Chrome #17

codef0rmer opened this issue Sep 19, 2015 · 11 comments · Fixed by #146

Comments

@codef0rmer
Copy link

Following code works fine - opens the exact URL in chrome.

var open = require("opn");
open('http://codef0rmer.github.io/eShell/index.html#/1?name=foobar', {app: 'chrome'});

However, if Chrome is a default browser and it's not mentioned then both hash and querystrings are stripped.

var open = require("opn");
open('http://codef0rmer.github.io/eShell/index.html#/1?name=foobar');

Any idea why spawn strips querystring?

@watson
Copy link
Contributor

watson commented Sep 19, 2015

My default browser is Safari, but I just checked and this doesn't seem to be an issue there. Which OS do you use?

@codef0rmer
Copy link
Author

Make Chrome your default browser in Windows 10 and run 2nd snippet from a terminal to reproduce the issue.

@sindresorhus
Copy link
Owner

Works fine for me on Windows 8.1 with Chrome. I don't have Windows 10 to test on.

@codef0rmer
Copy link
Author

@sindresorhus: It works fine on Windows 8 but not on Windows 10. Same issue even with node-open :-(

@codef0rmer
Copy link
Author

@sindresorhus: After some testing, I realized the problem was # in the URL, it strips everything after that. I also noticed target = target.replace(/&/g, '^&'); in your source and googled the entire web for # with no luck.

Just dark web is remaining now ;-)

@codef0rmer
Copy link
Author

BTW, it's "cmd /c "start http://codef0rmer.github.io/eShell/index.html#/1?name=foobar" strips content followed by #.

@sindresorhus
Copy link
Owner

Does cmd /c "start \"http://codef0rmer.github.io/eShell/index.html#/1?name=foobar\"" work?

@codef0rmer
Copy link
Author

Nope.

image

@watson
Copy link
Contributor

watson commented Oct 6, 2015

Seems to me that the escape chars (\) in front and back of the URL is messing things up. I'm not any good with Windows, but may try single quotes instead?, E.g:

cmd /c "start 'http://codef0rmer.github.io/eShell/index.html#/1?name=foobar'"

Or the reverse:

cmd /c 'start "http://codef0rmer.github.io/eShell/index.html#/1?name=foobar"'

@codef0rmer
Copy link
Author

@watson: No luck - The same error.

@HansHammel
Copy link

is this closed cause

var open = require("opn");
open('http://codef0rmer.github.io/eShell/index.html#/1?name=foobar', {app: 'chrome'});

works for me on win10
btw: no quotes work from commandline (IE - default)
cmd /c start http://codef0rmer.github.io/eShell/index.html#/1?name=foobar

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

Successfully merging a pull request may close this issue.

4 participants