SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Hybrid View

  1. #1
    SitePoint Enthusiast Diamax's Avatar
    Join Date
    Jul 2002
    Location
    North America
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation No Left or Right Drag and Drop Shortcut - Help Please!

    Hello guys!! I'm new in this forum!

    I'm working on putting togheter my website, and I want that people who are visiting my website to not be able to right-left drag (and drop) and make shortcuts of the links I have on my website on their desktop or anywhere else on their computer.

    I only want them to be able to add the website to favourites, if they want that, thru the normal procedure, using the menu (Favourites->Add To Favourires).

    Does anyone one knows how I can do that? Can you please helme with this?

    Thank You Very Much!
    Duras mx

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try ondragstart="return false;" for the elements

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  3. #3
    SitePoint Enthusiast Diamax's Avatar
    Join Date
    Jul 2002
    Location
    North America
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank You Very Very Much Flawless_Koder!!

    I knew is something with "ondragstart" but I was doing it all wrong, I was putting that into the body tag thinking that I can apply it to all the elements at once.
    What I was doing was:

    <Body bgcolor="black" ondragstart="false">

    As you can see I was actually very wrong the way I was doing it. I guess it cannot be applied to all the links in the page at once, but that is not problem at all.

    If I understand it correctly what I want it should look something like this:

    <a href="http://www.mywebpage.com" ondragstart="return false;">
    <font color=red>Click Here</font></a>

    I have to ask you one more favour about this, if you don't mind.
    Do you know how that can be done to work in Netscape too?

    About the attribute that i have to use to work in Netscape I have not even a vague idea.

    Again Thank You a Lot!!
    I really appreciate your answer!!
    Duras mx

  4. #4
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why on earth do you want to stop people doing that? As a general rule, if you ever find yourself wanting to limit what users can do when theyt are on your site you should stop, hit yourself over the head with something solid and get on with creating sites that reward your visitors rather than driving them away.

    ondragstart is an IE only event and wouldn't work for users of non-IE browsers (like myself) anyway.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Penns Woods
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Why on earth do you want to stop people doing that? As a general rule, if you ever find yourself wanting to limit what users can do when theyt are on your site you should stop, hit yourself over the head with something solid and get on with creating sites that reward your visitors rather than driving them away.
    let's see, got anything solid laying around...
    If you want some serious inspiration, don't stop until you see stars
    // PS! My brain just hit a bad sector...

  6. #6
    SitePoint Enthusiast Diamax's Avatar
    Join Date
    Jul 2002
    Location
    North America
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Skunk!!

    How about this?? at school some of the people know about my website, one day we had a project, and one girl took an entire page of my website and put it on her project, after that she went around saying that is her creation, she only changed the pictures, but as she knows almost nothing about html - I don't know much either... but still much more than she knows - she came to me to fix the way those pictures look in the page, saying that she only was inspired by my webpage, she tries to sell ice to the eschimos...
    I didn't say anything and I helped her, but of course I didn't like that at all.
    And I know that thing doesn't wotk in Netscape, that's why I was asking about how it would be in Netscape.

    Cya!
    Duras mx

  7. #7
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, since you're already strictly IE, I'd do it like this
    Code:
    <html>
    <head>
    <title>Drag Cancelling Text</title>
    
    <style>
    body {font: Arial 12px;}
    </style>
    
    <script language="javascript" type="text/javascript">
    function checkObj(trigger)
    	{
    	if (trigger.tagName == 'A' || trigger.parentNode.tagName == 'A')
    		return false
    	return true;
    	}
    </script>
    
    </head>
    
    <body onDragStart="return checkObj(event.srcElement)">
    
    <a href="#">Link1</a><br>
    <a href="#">Link2</a><br>
    <img src="pic.gif"><br>
    <a href="#">Link3</a><br>
    <a href="#"><img src="pic.gif"></a><br>
    <p>blah blah <a href="#">blah</a> blah blah</p>
    <a href="#">Link4</a><br>
    
    </body>
    </html>
    That way you don't have to attach the onDragStart() event to EVERY single anchor. As you can see, the only draggable object is the image w/o anchors around it.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  8. #8
    SitePoint Enthusiast Diamax's Avatar
    Join Date
    Jul 2002
    Location
    North America
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank You Beetle!!

    Nice to have more than one way of doing things.
    I'll try that to see how it goes.

    Cya!
    Duras mx

  9. #9
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But the technique you described does absolutely nothing to stop a potential theif from selecting the "save page" option from the browser's edit menu.

    As has been discussed on these forums many times before, the only way you can be sure of stopping people from "stealing" your HTML is not to put it on the web in the first place. The same goes for your graphics. That's just a side effect of how the web works.

  10. #10
    SitePoint Enthusiast Diamax's Avatar
    Join Date
    Jul 2002
    Location
    North America
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Skunk!!

    No Drag actually helps in combination with scrambling the script is descuraging stealling of the code.

    Bye!
    Duras mx

  11. #11
    SitePoint Enthusiast Diamax's Avatar
    Join Date
    Jul 2002
    Location
    North America
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That actually is becasue I don't want to deny access to viewing the code to all the pages, only to certain pages.

    Cya!
    Duras mx


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •