473,387 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Prevent Stop Block certain HTML Tag from being Copied e.g. URL <a> tag

i want to make it so that when a user copies an image from a website and pastes this image in, say, their email client, the <a> tag URL which surrounds the image tag is not copied along with the image.

This was brought to my attention by a colleague who copied images from the website into Outlook which retained the URL somehow. As she did not want the URL to be sent to the recipient, only the image. I told her she could simply right click -> remove hyperlink but she didn't want to have to do this, And one could easily forget to.

The fix in my mind -> would be to have something in the html prevent the <a> tag from being copied when the user right clicks to copy image. Does anybody understand what I am trying to say? I can't really think of an analogy that would be relevant.
Dec 8 '17 #1
3 2238
gits
5,390 Expert Mod 4TB
well - this is a pretty strange requirement - since you can only do something that you can control - so only on websites where you have access to the code. there is something like this:

https://developer.mozilla.org/en-US/...Element/oncopy

and take note of something like that as well:

https://www.quirksmode.org/dom/events/cutcopypaste.html

but i suggest to not use it - it alters the normal behaviour of the browser displaying a webpage that a user might expect - so may be one of your colleages wants to copy all while another one doesnt. fiddling around with standard behaviours on a website often leads to annoyance for users. usually the receiving app has to take care of what should be pasted to it - and it does already. since the 'remove hyperlink' option already is there. just dont copy the tag and it wouldnt even be there - so whats copied is usually even pasted - thats how it should work and everyone expect that.

but if you have to for some reason - u can fiddle around with the cut/copy events in this case.
Feb 22 '18 #2
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>http://calculator</title>
  4. </head>
  5.  
  6. <body bgcolor="black" topmargin="100" leftmargin="100">
  7. <table border="100" >
  8. <td>
  9. <table border="6" cellspacing="1" cellspadding="2" bgcolor="orang">
  10. <TD>
  11. <form name="Calc">
  12. <table border="10" cellspacing="2" cellspadding="6">
  13. <th bgcolor="blue">
  14. <table  border="1" width="250" size="80" cellspacing="10" cellspadding="15">
  15. <tr>
  16. <td>
  17. <input type="text" name="Numbers" size="16" />
  18. </td>
  19. </tr>
  20. <tr>
  21. <td>
  22. <input type="button" value="  1  " onClick="document.Calc.Numbers.value += '1'"/>
  23. <input type="button" value="  2  " onClick="document.Calc.Numbers.value += '2'"/>
  24. <input type="button" value="  3  " onClick="document.Calc.Numbers.value += '3'"/>
  25. <input type="button" value="  +  " onClick="document.Calc.Numbers.value += '+'"/>
  26. <br />
  27. <input type="button" value="  4  " onClick="document.Calc.Numbers.value += '4'"/>
  28. <input type="button" value="  5  " onClick="document.Calc.Numbers.value += '5'"/>
  29. <input type="button" value="  6  " onClick="document.Calc.Numbers.value += '6'"/>
  30. <input type="button" value="  -   " onClick="document.Calc.Numbers.value += '-'"/>
  31. <br />
  32. <input type="button" value="  7  " onClick="document.Calc.Numbers.value += '7'"/>
  33. <input type="button" value="  8  " onClick="document.Calc.Numbers.value += '8'"/>
  34. <input type="button" value="  9  " onClick="document.Calc.Numbers.value += '9'"/>
  35. <input type="button" value="  x  " onClick="document.Calc.Numbers.value += '*'"/>
  36. <br />
  37. <input type="button" value=" .    " onclick="document.Calc.Numbers.value +='.'"/>
  38. <input type="button" value="  0  " onClick="document.Calc.Numbers.value += '0'"/>
  39. <input type="button" value="  /  " onClick="document.Calc.Numbers.value  += '/ '"/>
  40. <input type="button" value="  %  " onClick="document.Calc.Numbers.value += '/100'"/>
  41. <input type="button" value="  =  " onClick="document.Calc.Numbers.value = eval(Calc.Numbers.value)"/>
  42. <br />
  43. </td>
  44. </tr>
  45. </table>
  46. <input type="button" value="  AC  " onClick="document.Calc.Numbers.value  = ' '"/>
  47.  
  48. </th>
  49. </table>
  50. </form>
  51. <h1>Enjoye <i><samp style="color: blue;" margin="10">calculator</samp></i></h1>
  52. <marquee><h3>Develop by Dhananjay pandey</h3></marquee>
  53. </TD>
  54. </table>
  55. </td>
  56. </table>
  57. </body>
  58. </html>
Feb 22 '18 #3
Frinavale
9,735 Expert Mod 8TB
If you really want to do this, you could try removing the <a> tags around the images and use JavaScript to hook up onClick Events for the images that would do what the <a> tag would have done.

(This assumes that you own the website and can edit the HTML/JavaScript that you are talking about. This cannot be applied to websites that you do not own/control/maintain)
Feb 22 '18 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Rob | last post by:
Each time a webform is posted back (submitted), another URL is added to the browser's history list. My web application allows a back button to return to previously visited pages, but I do not wish...
5
by: TPS | last post by:
I want to add a block of html to asp.net page. How can I add the HTML to a certain location on my page. Thanks. TPS
2
by: JIM.H. | last post by:
Hello, I am using asp.net c#, when users login into my application through mixed windows-form authentication, is there a way that they can see the source code, if yes, how can I prevent that? I...
5
by: EqDev | last post by:
I have a class that is a control derived from UserControl. I want to use serialization and deserialization with this calss but I get an exception "Cannot serialize member...
2
by: masterofzen | last post by:
Hi, everybody -- first post for me, though I land here via Google all the time. This is the first time, though, that I just haven't been able to find anything even remotely resembling a solution to...
10
by: Barry L. Camp | last post by:
Hi all... hope someone can help out. Not a unique situation, but my search for a solution has not yielded what I need yet. I'm trying to come up with a regular expression for a...
4
by: since | last post by:
How do I in IE prevent the onclick action from being fired when I am done dragging? have tried "window.event.cancelBubble = true", for onmouseup , onmousedown, and onmousemove handlers. The onclick...
21
by: whitesmith | last post by:
Hello, I'm in the process of putting up a website -- my first. There's a number of tools (like WinHTTrack) that allow an entire site to be copied to someone's hard drive to be examined at their...
3
by: damola | last post by:
Good day everyone Please how can i prevent access to certain forms in ms access database 2007. i want it to be in such a way that when i enter user login,it automatically detects the forms the user...
1
by: mcfly1204 | last post by:
Most of our users are configured in AD to use roaming profiles. For one user in particular, their roaming profile is not being copied to one of our terminal servers when the user logs in. We have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.