Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

How do I find out the URL of the page a document was downloaded from?

  • 7 uphendule
  • 1 inale nkinga
  • 1 view
  • Igcine ukuphendulwa ngu danwebb

more options

I downloaded a PDF several months ago; I can see it in my downloads history. When I right click it there, I see the link to the PDF itself, but I need to know the actual page it came from. I've checked my History, but cannot identify the page. Is there a definitive way of determining the URL of the page that linked to the document?

I downloaded a PDF several months ago; I can see it in my downloads history. When I right click it there, I see the link to the PDF itself, but I need to know the actual page it came from. I've checked my History, but cannot identify the page. Is there a definitive way of determining the URL of the page that linked to the document?

All Replies (7)

more options

Open the Download Manager window and select that file.

Copy and paste this code in the Code field in the Error Console and click the Evaluate button.

  • Firefox/Tools > Web Development > Error Console

The code adds a tooltip to the area with the file type icon at the left hand side of each entry in the DM window and shows a tooltip when you hover that area.
It only works for entries that are currently visible in the DM and not for new entries that are added by downloading files and only as long as the DM window is kept open, so you need to rerun the code in the Error Console to get a tooltip.


const Cc=Components.classes, Ci=Components.interfaces;
var enumerator=Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator).getEnumerator(null);
while(enumerator.hasMoreElements()){var win=enumerator.getNext();

if(win.location=="chrome://mozapps/content/downloads/downloads.xul"){
var i,r,R,C='';
r=win.document.getElementById("downloadView").getElementsByTagName("richlistitem");

for(i=0;R=r[i];i++){
var fP=R.getAttribute("path");
var fU=R.getAttribute("uri");
var sT=parseInt(R.getAttribute("startTime"));
var eT=parseInt(R.getAttribute("endTime"));
var cB=parseInt(R.getAttribute("currBytes"));
var mB=parseInt(R.getAttribute("maxBytes"));
var rU=R.hasAttribute("referrer")?R.getAttribute("referrer"):"<no referrer>";

var sD=cB/(eT-sT);
var tT=[];

tT.push("FILE: "+fP);
tT.push("URI: "+fU);
tT.push("REF: "+rU);
tT.push("");
tT.push("Total Time: "+((eT-sT)/1E3)+" sec.");
tT.push("Curr Bytes: "+cB+" bytes"+((cB==mB)?" (OK)":"(part)"));
tT.push("Max Bytes: "+mB+" bytes");
tT.push("Download speed: "+sD.toFixed(3)+" KB/sec");

R.setAttribute("tooltiptext",tT.join("\n"));
if(R.getAttribute("selected")=="true"){C=tT;}
}
if(C)prompt(C.join("\n"),C);
}}

Okulungisiwe ngu cor-el

more options

Hi, Thanks so much for that. Cool information to know. However, it still only shows me the link to the PDF file itself, not to the page that linked to it.

Okulungisiwe ngu danwebb

more options

If the downloaded file is still listed in the Downloads window, you can simply right-click it and choose Go to Download Page.

If not, then the only suggestion I have is to make a note of date and time listed for the item in the Downloads section of the Library. You can then look for history items recorded shortly before that date and time, and you're likely to find what you're looking for.

more options

OK. I've edited my above post ([*]) to add the referrer, so it should show the download page if available in the tooltip.

Okulungisiwe ngu cor-el

more options

@Gingerbread_Man: "Go to download page" is greyed out. And the download information is only showing a date, not a time. I have gone into History for that day and can see the file download, but not the page that linked to it. Weird. There are only 20 or so pages listed for that day, so it's not like I'm just not seeing it.

@cor-el: This modified code doesn't work the same way as previously. I followed your directions again; this time it doesn't show information on hover like it did before. However, the console dialogue box appears, and it states that there is no referrer (if that's relevent; didn't take any notice of what it said the previous time). Perhaps that just means there isn't one.

This is a real curiosity. The file must have come from a link on a page, but my browser just isn't giving it up. It's not important enough to persue and I don't want to waste anyone's time.

Thanks to you both for your assistance.

cheers.

Okulungisiwe ngu danwebb

more options

The referrer is the page that you open via the "Go to Download Page" menu item.
You can check that out with other items that do not have "Go to Download Page" grayed.

If that item is grayed then that means that that location wasn't saved and that the file probably wasn't downloaded via a link on a web page. You may have left-click the link instead of using "Save Link as". Left-clicking a link to initiate a download doesn't seem to save the referrer.

more options

Understood. Thanks for the explanation; very interesting.