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

Incorrect GM_openInTab behavior with relative paths #1719

Closed
MayhemYDG opened this Issue Mar 3, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@MayhemYDG
Copy link

MayhemYDG commented Mar 3, 2013

/* FAIL: */
// opens https://path.com/ (WTF)
GM_openInTab('path');
// opens file:///path
GM_openInTab('/path');
// opens file:////domain.org
GM_openInTab('//domain.org');

/* WORK: */
// opens current protocol + current domain + current path + 'path'
window.open('path', '_blank');
// opens current protocol + current domain + '/path'
window.open('/path', '_blank');
// opens current protocol + 'domain.org'
window.open('//domain.org', '_blank');

I fixed that in my script by basically doing the following, which I really shouldn't have to:

open = function(URL) {
  var a = document.createElement('a');
  a.href = URL;
  GM_openInTab(a.href);
};
@janekptacijarabaci

This comment has been minimized.

Copy link
Contributor

janekptacijarabaci commented Apr 23, 2013

In other words:
RFC 2396
Point No. 5 (5.2)

@arantius arantius closed this in c3d80bf May 23, 2013

@MayhemYDG

This comment has been minimized.

Copy link

MayhemYDG commented May 23, 2013

Yay.

@arantius

This comment has been minimized.

Copy link
Collaborator

arantius commented Jun 7, 2013

This fix is now in 1.10beta1; let me know if it works for you:
https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/versions/?page=1#version-1.10beta1

@MayhemYDG

This comment has been minimized.

Copy link

MayhemYDG commented Jun 7, 2013

Works for me.

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