data-lynx-uri links on facebookWhy can't I see my existing albums in the Facebook Exporter for iPhoto...
What happens if you roll doubles 3 times then land on "Go to jail?"
Lay out the Carpet
Roman Numeral Treatment of Suspensions
India just shot down a satellite from the ground. At what altitude range is the resulting debris field?
Short story about space worker geeks who zone out by 'listening' to radiation from stars
Did the DC-9 ever use RATO in revenue service?
System.debug(JSON.Serialize(o)) Not longer shows full string
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
Why not increase contact surface when reentering the atmosphere?
Two monoidal structures and copowering
Is `x >> pure y` equivalent to `liftM (const y) x`
Large drywall patch supports
Tiptoe or tiphoof? Adjusting words to better fit fantasy races
Increase performance creating Mandelbrot set in python
You cannot touch me, but I can touch you, who am I?
Customer Requests (Sometimes) Drive Me Bonkers!
Is this apparent Class Action settlement a spam message?
What is the opposite of 'gravitas'?
CREATE opcode: what does it really do?
Escape a backup date in a file name
Is there a korbon needed for conversion?
Is HostGator storing my password in plaintext?
What can we do to stop prior company from asking us questions?
Is there a good way to store credentials outside of a password manager?
data-lynx-uri links on facebook
Why can't I see my existing albums in the Facebook Exporter for iPhoto plugin?Log into facebook from a prism appWhere can you see the data that's been recorded by a tracking cookie?Restore my browser's middle-click behaviourWhy are all links suddenly purple (visited)?Downloading photos from Facebook group pagesChrome can't load specific pages - possibly due to JavascriptHow clicking on an image anchor does NOT update my page history buttons?Digikam Facebook upload fails upon Change_Account: “User must specify a valid extended permission or data permission”How do I stop a Facebook account from writing spam posts?
I've noticed a long time ago that links that are posted on facebook are somehow handled in a twisted way. If I hover with my mouse over the link or page preview, my browser (in this case, Safari for Mac) displays the expected link that was pasted in the post (e.g. http://www.example.com/
). BUT if I right-click and copy the link, then paste it in some new tab's address bar, the URI is quite different: it's gonna be something like https://l.facebook.com/l.php?u=http%3A%2F%2Fwww.example.com%2F&h=xxxxx
where xxxx
is actually a unique identifier, no doubt linked to my account and whatever else. I'm assuming that facebook uses this to track what people click on. I'm wondering whether they're trying to "conceal" that fact by using a scheme where the browser doesn't show the effective, tracking link. I've looked at the HTML source and it looks like the a
tag uses the proper URI as its href
attribute, but then it has two additional attributes, data-lynx-mode
with value origin
(from what I've seen, there may be others) and data-lynx-uri
which contains the link that is actually copied and followed on user interaction, the one I've mentioned above. I've done a quick search on the net and couldn't find much documentation about these attributes -- but they seem to be mostly if not only used in connection with facebook links -- although the browser seems to react in a particular way to them, somehow inconsistent because what it shows in the status bar is different from what it copies to the clipboard. Does anyone have more information about them? Could they be simply proprietary and used by some javascript code that would override the normal link following? Can they be "ignored" so the browser follows the proper link instead and doesn't feed facebook's profiling machine?
Thanks for your ideas!
EDIT:
stachu's answer works well (using Tampermonkey for Safari, I'm taken directly to the original page when clicking a link), however it's not quite sufficient for my particular use: I'm using different browsers for Facebook and general browsing (call it paranoia), and what I usually do is copy the link from Safari and open it in the other browser. Right-clicking and selecting "Copy link" from Safari still gets the tracking link, not the actual href
. I'm trying to find out what happens when I do that, maybe some javascript catches the action and garbles the link, or does Safari default to copying this data-lynx-uri
when it's present??
EDIT 2:
Facebook does juggle back and forth with the link, changing the value of the href
attribute to the contents of data-lynx-uri
when a right-click occurs, and setting it back to its original value when you hover over the element – to me it really looks like they're just trying to obfuscate the display and fool the user into not seeing the redirection. I'm trying to catch the right-click and restore the value of the link using javascript/Tampermonkey, but for some reason my function is not getting called :-|.
document.addEventListener('contextmenu', function(e) {
Array.from(e.target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => e.target.removeAttribute(attribute.name));
var href = e.target.getAttribute("href");
var regex = /^https://l.facebook.com/l.php?u=(http.*?)&.*$/;
var match = regex.exec(href);
if(match[1]) {
var uri = match[1].replace(/%3A/g, ':').replace(/%2F/g, '/').replace(/%26/g, '&').replace(/%3D/g, '=').replace(/%3F/g, '?');
e.target.setAttribute("href", uri);
}
}, false);
browser javascript facebook links tracking
add a comment |
I've noticed a long time ago that links that are posted on facebook are somehow handled in a twisted way. If I hover with my mouse over the link or page preview, my browser (in this case, Safari for Mac) displays the expected link that was pasted in the post (e.g. http://www.example.com/
). BUT if I right-click and copy the link, then paste it in some new tab's address bar, the URI is quite different: it's gonna be something like https://l.facebook.com/l.php?u=http%3A%2F%2Fwww.example.com%2F&h=xxxxx
where xxxx
is actually a unique identifier, no doubt linked to my account and whatever else. I'm assuming that facebook uses this to track what people click on. I'm wondering whether they're trying to "conceal" that fact by using a scheme where the browser doesn't show the effective, tracking link. I've looked at the HTML source and it looks like the a
tag uses the proper URI as its href
attribute, but then it has two additional attributes, data-lynx-mode
with value origin
(from what I've seen, there may be others) and data-lynx-uri
which contains the link that is actually copied and followed on user interaction, the one I've mentioned above. I've done a quick search on the net and couldn't find much documentation about these attributes -- but they seem to be mostly if not only used in connection with facebook links -- although the browser seems to react in a particular way to them, somehow inconsistent because what it shows in the status bar is different from what it copies to the clipboard. Does anyone have more information about them? Could they be simply proprietary and used by some javascript code that would override the normal link following? Can they be "ignored" so the browser follows the proper link instead and doesn't feed facebook's profiling machine?
Thanks for your ideas!
EDIT:
stachu's answer works well (using Tampermonkey for Safari, I'm taken directly to the original page when clicking a link), however it's not quite sufficient for my particular use: I'm using different browsers for Facebook and general browsing (call it paranoia), and what I usually do is copy the link from Safari and open it in the other browser. Right-clicking and selecting "Copy link" from Safari still gets the tracking link, not the actual href
. I'm trying to find out what happens when I do that, maybe some javascript catches the action and garbles the link, or does Safari default to copying this data-lynx-uri
when it's present??
EDIT 2:
Facebook does juggle back and forth with the link, changing the value of the href
attribute to the contents of data-lynx-uri
when a right-click occurs, and setting it back to its original value when you hover over the element – to me it really looks like they're just trying to obfuscate the display and fool the user into not seeing the redirection. I'm trying to catch the right-click and restore the value of the link using javascript/Tampermonkey, but for some reason my function is not getting called :-|.
document.addEventListener('contextmenu', function(e) {
Array.from(e.target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => e.target.removeAttribute(attribute.name));
var href = e.target.getAttribute("href");
var regex = /^https://l.facebook.com/l.php?u=(http.*?)&.*$/;
var match = regex.exec(href);
if(match[1]) {
var uri = match[1].replace(/%3A/g, ':').replace(/%2F/g, '/').replace(/%26/g, '&').replace(/%3D/g, '=').replace(/%3F/g, '?');
e.target.setAttribute("href", uri);
}
}, false);
browser javascript facebook links tracking
add a comment |
I've noticed a long time ago that links that are posted on facebook are somehow handled in a twisted way. If I hover with my mouse over the link or page preview, my browser (in this case, Safari for Mac) displays the expected link that was pasted in the post (e.g. http://www.example.com/
). BUT if I right-click and copy the link, then paste it in some new tab's address bar, the URI is quite different: it's gonna be something like https://l.facebook.com/l.php?u=http%3A%2F%2Fwww.example.com%2F&h=xxxxx
where xxxx
is actually a unique identifier, no doubt linked to my account and whatever else. I'm assuming that facebook uses this to track what people click on. I'm wondering whether they're trying to "conceal" that fact by using a scheme where the browser doesn't show the effective, tracking link. I've looked at the HTML source and it looks like the a
tag uses the proper URI as its href
attribute, but then it has two additional attributes, data-lynx-mode
with value origin
(from what I've seen, there may be others) and data-lynx-uri
which contains the link that is actually copied and followed on user interaction, the one I've mentioned above. I've done a quick search on the net and couldn't find much documentation about these attributes -- but they seem to be mostly if not only used in connection with facebook links -- although the browser seems to react in a particular way to them, somehow inconsistent because what it shows in the status bar is different from what it copies to the clipboard. Does anyone have more information about them? Could they be simply proprietary and used by some javascript code that would override the normal link following? Can they be "ignored" so the browser follows the proper link instead and doesn't feed facebook's profiling machine?
Thanks for your ideas!
EDIT:
stachu's answer works well (using Tampermonkey for Safari, I'm taken directly to the original page when clicking a link), however it's not quite sufficient for my particular use: I'm using different browsers for Facebook and general browsing (call it paranoia), and what I usually do is copy the link from Safari and open it in the other browser. Right-clicking and selecting "Copy link" from Safari still gets the tracking link, not the actual href
. I'm trying to find out what happens when I do that, maybe some javascript catches the action and garbles the link, or does Safari default to copying this data-lynx-uri
when it's present??
EDIT 2:
Facebook does juggle back and forth with the link, changing the value of the href
attribute to the contents of data-lynx-uri
when a right-click occurs, and setting it back to its original value when you hover over the element – to me it really looks like they're just trying to obfuscate the display and fool the user into not seeing the redirection. I'm trying to catch the right-click and restore the value of the link using javascript/Tampermonkey, but for some reason my function is not getting called :-|.
document.addEventListener('contextmenu', function(e) {
Array.from(e.target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => e.target.removeAttribute(attribute.name));
var href = e.target.getAttribute("href");
var regex = /^https://l.facebook.com/l.php?u=(http.*?)&.*$/;
var match = regex.exec(href);
if(match[1]) {
var uri = match[1].replace(/%3A/g, ':').replace(/%2F/g, '/').replace(/%26/g, '&').replace(/%3D/g, '=').replace(/%3F/g, '?');
e.target.setAttribute("href", uri);
}
}, false);
browser javascript facebook links tracking
I've noticed a long time ago that links that are posted on facebook are somehow handled in a twisted way. If I hover with my mouse over the link or page preview, my browser (in this case, Safari for Mac) displays the expected link that was pasted in the post (e.g. http://www.example.com/
). BUT if I right-click and copy the link, then paste it in some new tab's address bar, the URI is quite different: it's gonna be something like https://l.facebook.com/l.php?u=http%3A%2F%2Fwww.example.com%2F&h=xxxxx
where xxxx
is actually a unique identifier, no doubt linked to my account and whatever else. I'm assuming that facebook uses this to track what people click on. I'm wondering whether they're trying to "conceal" that fact by using a scheme where the browser doesn't show the effective, tracking link. I've looked at the HTML source and it looks like the a
tag uses the proper URI as its href
attribute, but then it has two additional attributes, data-lynx-mode
with value origin
(from what I've seen, there may be others) and data-lynx-uri
which contains the link that is actually copied and followed on user interaction, the one I've mentioned above. I've done a quick search on the net and couldn't find much documentation about these attributes -- but they seem to be mostly if not only used in connection with facebook links -- although the browser seems to react in a particular way to them, somehow inconsistent because what it shows in the status bar is different from what it copies to the clipboard. Does anyone have more information about them? Could they be simply proprietary and used by some javascript code that would override the normal link following? Can they be "ignored" so the browser follows the proper link instead and doesn't feed facebook's profiling machine?
Thanks for your ideas!
EDIT:
stachu's answer works well (using Tampermonkey for Safari, I'm taken directly to the original page when clicking a link), however it's not quite sufficient for my particular use: I'm using different browsers for Facebook and general browsing (call it paranoia), and what I usually do is copy the link from Safari and open it in the other browser. Right-clicking and selecting "Copy link" from Safari still gets the tracking link, not the actual href
. I'm trying to find out what happens when I do that, maybe some javascript catches the action and garbles the link, or does Safari default to copying this data-lynx-uri
when it's present??
EDIT 2:
Facebook does juggle back and forth with the link, changing the value of the href
attribute to the contents of data-lynx-uri
when a right-click occurs, and setting it back to its original value when you hover over the element – to me it really looks like they're just trying to obfuscate the display and fool the user into not seeing the redirection. I'm trying to catch the right-click and restore the value of the link using javascript/Tampermonkey, but for some reason my function is not getting called :-|.
document.addEventListener('contextmenu', function(e) {
Array.from(e.target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => e.target.removeAttribute(attribute.name));
var href = e.target.getAttribute("href");
var regex = /^https://l.facebook.com/l.php?u=(http.*?)&.*$/;
var match = regex.exec(href);
if(match[1]) {
var uri = match[1].replace(/%3A/g, ':').replace(/%2F/g, '/').replace(/%26/g, '&').replace(/%3D/g, '=').replace(/%3F/g, '?');
e.target.setAttribute("href", uri);
}
}, false);
browser javascript facebook links tracking
browser javascript facebook links tracking
edited Apr 30 '18 at 16:10
David
asked Apr 27 '18 at 15:44
DavidDavid
112
112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can add your own scripts to Facebook site using, for example Greasemonkey if you are using FireFox.
Example script which fires on each click
document.addEventListener('click', event => {
let target = event.target;
if (target.tagName.toLowerCase() === "a") {
Array.from(target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => target.removeAttribute(attribute.name));
}
})
If target element (which you clicked) is a link (a
tag) script removes data-lynx-*
attributes.
You should check that some scripts have href
attribute changed into Facebook tracking links (domain l.facebook.com
) and add this case to your script.
You should check that this script works even with AJAX added content.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1317766%2fdata-lynx-uri-links-on-facebook%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can add your own scripts to Facebook site using, for example Greasemonkey if you are using FireFox.
Example script which fires on each click
document.addEventListener('click', event => {
let target = event.target;
if (target.tagName.toLowerCase() === "a") {
Array.from(target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => target.removeAttribute(attribute.name));
}
})
If target element (which you clicked) is a link (a
tag) script removes data-lynx-*
attributes.
You should check that some scripts have href
attribute changed into Facebook tracking links (domain l.facebook.com
) and add this case to your script.
You should check that this script works even with AJAX added content.
add a comment |
You can add your own scripts to Facebook site using, for example Greasemonkey if you are using FireFox.
Example script which fires on each click
document.addEventListener('click', event => {
let target = event.target;
if (target.tagName.toLowerCase() === "a") {
Array.from(target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => target.removeAttribute(attribute.name));
}
})
If target element (which you clicked) is a link (a
tag) script removes data-lynx-*
attributes.
You should check that some scripts have href
attribute changed into Facebook tracking links (domain l.facebook.com
) and add this case to your script.
You should check that this script works even with AJAX added content.
add a comment |
You can add your own scripts to Facebook site using, for example Greasemonkey if you are using FireFox.
Example script which fires on each click
document.addEventListener('click', event => {
let target = event.target;
if (target.tagName.toLowerCase() === "a") {
Array.from(target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => target.removeAttribute(attribute.name));
}
})
If target element (which you clicked) is a link (a
tag) script removes data-lynx-*
attributes.
You should check that some scripts have href
attribute changed into Facebook tracking links (domain l.facebook.com
) and add this case to your script.
You should check that this script works even with AJAX added content.
You can add your own scripts to Facebook site using, for example Greasemonkey if you are using FireFox.
Example script which fires on each click
document.addEventListener('click', event => {
let target = event.target;
if (target.tagName.toLowerCase() === "a") {
Array.from(target.attributes).filter(attribute => attribute.name.startsWith("data-lynx-")).forEach(attribute => target.removeAttribute(attribute.name));
}
})
If target element (which you clicked) is a link (a
tag) script removes data-lynx-*
attributes.
You should check that some scripts have href
attribute changed into Facebook tracking links (domain l.facebook.com
) and add this case to your script.
You should check that this script works even with AJAX added content.
answered Apr 29 '18 at 11:31
stachustachu
1014
1014
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1317766%2fdata-lynx-uri-links-on-facebook%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown