A page element is not copied
Halo, Firefox Users.
Firefox 22.0 on Windows7.
I have seen this issue for such a long time. Is this a bug ?
Please, visit this site by using Firefox.
Please, do right-click and select "Select All", then right-click and select "Copy".
Paste the copied elements as plain-text onto any text editor.
I see that all dates are not copied.
In the text that I paste, I see:
"… asked on ..." (no date)
"… replied on ..." (no date)
If I use MS-InternetExplorer, the pasted text has:
"… asked on
July 15, 2010 ..."
"… replied on
September 4, 2010 ..."
… and so on.
Thank you.
Ilungisiwe
Isisombulu esikhethiweyo
Hello, it's an unusual layout. The username is the display text of a link, but the date is the text of a button, although it is styled just like the username so this difference is not obvious:
<a href="http://answers.microsoft.com/en-us/profile/b7195fc2-0525-4652-973a-02ce0e415bf6">shadow49</a> asked on <div> <button>July 15, 2010</button>
Why doesn't Firefox include the text of buttons in its "plain text"? I don't know...
As a temporary workaround, you could convert the buttons to plain text using a snippet of script. Here's how:
(1) On the page, open the web console by pressing Ctrl+Shift+k
(2) Paste the following long line of code next to the caret (">") and press Enter to run it:
while(document.getElementsByTagName("button").length > 0){ but = document.getElementsByTagName("button")[0]; var txt = but.textContent; if(txt){ if(txt.length>0) but.parentNode.replaceChild(document.createTextNode(txt), but); else but.parentNode.removeChild(but);} else but.parentNode.removeChild(but);}
(3) Close the web console by pressing Ctrl+Shift+k
That isn't very convenient, but it could be automated a bit by creating a bookmarklet. Here's how.
First, copy this slightly modified script (select, Ctrl+c):
javascript: while(document.getElementsByTagName("button").length > 0){ but = document.getElementsByTagName("button")[0]; var txt = but.textContent; if(txt){ if(txt.length>0) but.parentNode.replaceChild(document.createTextNode(txt), but); else but.parentNode.removeChild(but);} else but.parentNode.removeChild(but);} void 0;
Next, if you are not displaying the Bookmarks Toolbar, you can display it using either:
- right-click a blank area of the tab bar > Bookmarks Toolbar
- tap the Alt key > View menu > Toolbars > Bookmarks Toolbar
Right-click on the Bookmarks Toolbar and choose New Bookmark.
Paste the code into the Location box (the second box).
Then type a useful name in the Name box (e.g., Btn2Txt) and click Add.
Now, when you want to hack the buttons in the page, click the bookmark to run the script.
Funda le mpendulo kwimeko leyo 👍 1All Replies (5)
happens to me too maybe it is a bug? you can file one at bugzilla
Isisombululo esiKhethiweyo
Hello, it's an unusual layout. The username is the display text of a link, but the date is the text of a button, although it is styled just like the username so this difference is not obvious:
<a href="http://answers.microsoft.com/en-us/profile/b7195fc2-0525-4652-973a-02ce0e415bf6">shadow49</a> asked on <div> <button>July 15, 2010</button>
Why doesn't Firefox include the text of buttons in its "plain text"? I don't know...
As a temporary workaround, you could convert the buttons to plain text using a snippet of script. Here's how:
(1) On the page, open the web console by pressing Ctrl+Shift+k
(2) Paste the following long line of code next to the caret (">") and press Enter to run it:
while(document.getElementsByTagName("button").length > 0){ but = document.getElementsByTagName("button")[0]; var txt = but.textContent; if(txt){ if(txt.length>0) but.parentNode.replaceChild(document.createTextNode(txt), but); else but.parentNode.removeChild(but);} else but.parentNode.removeChild(but);}
(3) Close the web console by pressing Ctrl+Shift+k
That isn't very convenient, but it could be automated a bit by creating a bookmarklet. Here's how.
First, copy this slightly modified script (select, Ctrl+c):
javascript: while(document.getElementsByTagName("button").length > 0){ but = document.getElementsByTagName("button")[0]; var txt = but.textContent; if(txt){ if(txt.length>0) but.parentNode.replaceChild(document.createTextNode(txt), but); else but.parentNode.removeChild(but);} else but.parentNode.removeChild(but);} void 0;
Next, if you are not displaying the Bookmarks Toolbar, you can display it using either:
- right-click a blank area of the tab bar > Bookmarks Toolbar
- tap the Alt key > View menu > Toolbars > Bookmarks Toolbar
Right-click on the Bookmarks Toolbar and choose New Bookmark.
Paste the code into the Location box (the second box).
Then type a useful name in the Name box (e.g., Btn2Txt) and click Add.
Now, when you want to hack the buttons in the page, click the bookmark to run the script.
Thanks for the replies, Waka_Flocka_Flame and jscher2000.
jscher2000, the script works.
Is it possible to make the script also "select all" page elements and "copy" them after converting the buttons to plain text ?
Well, I am pushing my luck here. :) It would be nicer if I can click the script once and it does 3 commands sequently. I do not know about javascript.
Thanks.
In Firefox, scripts are restricted in how they interact with the clipboard, so I don't think I can add that last step...
To select the entire document body, you can use this (it would go before the void 0 at the end):
var sel=window.getSelection(); sel.selectAllChildren(document.body);
At that point, you could press Ctrl+c or right-click > Copy. Does it work?
Thanks again, jscher2000.
Based on your explanation, I think the first script is already helpful enough for me now. Select All and Copy are easy for me to do manually.
I thought someone had reported this issue to Firefox team but then I found out that this issue was still there in latest version of FF. I remember that two FF add-ins for sending html contents to MS-OneNote face this issue too and one of the developers had seen it. I also have sent feedback to FF team.
Thank you so much for your replies and for the script.
-=-