Jump to content

Making left-click act as "Save Target As.."


Replicators

Recommended Posts

For my forums we offer downloads,but the actual links have to be secretive or as much as possible.I have found a script to disable right-clicking which is...<script language='JavaScript'><!-- var PopUpMsg = "Right click is disabled"; if (document.layers) window.captureEvents(event.MOUSEDOWN); function DisableRightClick(DisableRightClick){ if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) { alert(PopUpMsg); return false; } if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert(PopUpMsg); return false; } } window.onmousedown=DisableRightClick;document.onmousedown=DisableRightClick;//--></script> It only does it to 2 browser's,but i'd also like it to do it on firefox and any other known internet browser. Also i want to make it where when you left-click on a link it acts as if you right-clicked and selected "Save Target As.." but without doing it to the normal forum links.The links i am using is basically the same as downloading from attachments so they are not normal url links which makes my objective a bit hard to do. If someone could possibly help me with this,i'd be most gratefull.

Link to comment
Share on other sites

but i'd also like it to do it on firefox
Hmm, I was under the impression that what worked in Netscape worked in Firefox... Aren't they both built on the mozilla engine or something?
Link to comment
Share on other sites

Disabling right-click won't stop many people from scabbing links. You can just look in the status bar, or even the site source. And if you time it properly, you can get past that javascript quite easily. :)If anything, it just drives people away because they lose their browser functionality.with regards

Link to comment
Share on other sites

That all depends on what you offer,on whether it is worth it or not. What i wish microsoft to do is make a program for server's to have a invisible password sorta attached to any downloads,and the forum or website database would have that password,it would prevent off-site linking very good if that could be done. So can anyone please tell me the code to have the left-click function act as though you right-clicked and selected "Save Target As.."?But without affecting other normal forum links on the page?It may not be possible though as the type of link is the same as the normal links.Argh...

Link to comment
Share on other sites

What i wish microsoft to do is make a program for server's to have a invisible password sorta attached to any downloads
Microsoft isn't who you should ask. Ask the Gnutella network who makes linux servers instead, or whoever makes apache server. Microsoft sucks...
Link to comment
Share on other sites

@ Replicators,Why bother writing a SO MUCH too complicated script, for a so simple situation :)having a link that holds its target secret is not realy difficult...This is the normal syntax:

<a href="" target="_blank" title="">...</a>
And then always the HREF is displayed at the statusbar.To get that not to happen, you can add three levels of protection.1) Change the anchor to this:
<a href="http://This_is_censored" target="_blank" title="Click here for a nice download"  onclick='window.open("http://secretlink")'>DownloadPack</a>
This removes the link from the statusbar, but still opens the correct target2) Move the actual link even further away into an external file:
<script type="text/javascript" src="ExternalFile"></script><a href="http://This_is_censored" target="_blank" title="Click here for a nice download"  onclick='window.open("ExternalVariable[0]")'>DownloadPack0</a>
And in the external file, declare that variable with java script:
This completely removes the actual target from the sourcecode, into another file3) Write the External file by looping with PHP. But this does not protect any secret link, only how you are able to easily write the declaring of eg. hundred links. The output PHP gives, may be practically the same as with level 2I hope this helped :)
Link to comment
Share on other sites

You're right. I am not going to suggest to build a database :), but it would be very helpful in your case :(Instead, you could write a php program then to easily add a link to a flat file. I had a very similar case by my self, using hundreds of movie urls. I just added a PHP script and it got my dream combo :)

Link to comment
Share on other sites

Something like this will make it kind of hard for people to see your download location. They'll never see it in the source and unless they're using Telnet or something like it they wont see the Location header either.

<a href="download.php?id=1">

Then have a MySQL database with a list of files with unique id's. Make download.php have:

<?php $id=$_GET['id'];mysql_connect("127.0.0.1",$user,$password);mysql_select_db($database) or die( "Unable to select database");$query="SELECT name FROM files WHERE id='$id'";$result=mysql_query($query);$name = mysql_fetch_row($result);header("Location:http://example.com/".$name[0]);exit;?>

You could also have the id/filename references in a text file or something like that instead. The idea is to send an HTTP header to silently redirect to the file.

Link to comment
Share on other sites

And as in Nicks example above, how to add a file:

<form action="addprocess.php" method="post">Name: <input type="text" name="file_name" value=""><br />ID: <input type="text" name="file_id" value=""><br /><input type="submit" value="Add this file"><br /></form>
<?php$name=$_POST['file_name'];$id=$_POST['file_id']mysql_connect("127.0.0.1",$user,$password);mysql_select_db($database) or die( "Unable to select database");$query="INSERT INTO files (name,id) VALUES ('$name','$id')";$result=mysql_query($query);echo "Query succesfully executed!<br />";?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...