MozillaZine

no one can login to my website with mozilla

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
usmivkata
Guest
 

Post Posted November 12th, 2007, 12:57 pm

Hi,
when I use java script to protect my website text and images from being copied the fields for username and password in Mozilla become unwritable and no one can login. The other browsers are working without problems. Do you have any idea how to solve the problem?

Here is the script. I am not using it now on the website because of the login problems, but it is a joomla site. I hope this information helps.

Thanks in advance!


<script>

//Disable select-text script (IE4+, NS6+)

function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>

SK.
Moderator

User avatar
 
Posts: 20819
Joined: October 18th, 2007, 1:28 pm
Location: Third Rock From The Sun

Post Posted November 12th, 2007, 1:13 pm

This thread belongs in the Web Development / Standards Evangelism forum. However, you need to be registered to post there. Please register, return to this thread to let us know and we can move this thread to the appropriate forum. Please do not cross-post.
John 3:16 and Philippians 4:13

usmivkata
 
Posts: 8
Joined: November 12th, 2007, 1:51 pm

Post Posted November 12th, 2007, 1:53 pm

Would you please move it now :-)

SK.
Moderator

User avatar
 
Posts: 20819
Joined: October 18th, 2007, 1:28 pm
Location: Third Rock From The Sun

Post Posted November 12th, 2007, 1:58 pm

Someone already took care of it for us. :)
John 3:16 and Philippians 4:13

Omega X

User avatar
 
Posts: 8006
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Post Posted November 12th, 2007, 2:09 pm

Small Note, Javascript cannot fully protect text and images from being copied. If it can be seen it can be copied.
Latest: Firefox/58.0 *ESR/52.6.0 - Mobile/58.0 - Thunderbird/52.6.0 - SeaMonkey/2.49.1
Nightly: Nightly/60.0a1 - Mobile/60.0a1 - Daily/60.0a1 - SeaMonkey/2.56a1

usmivkata
 
Posts: 8
Joined: November 12th, 2007, 1:51 pm

Post Posted November 12th, 2007, 2:20 pm

I know that, but it is better then nothing. If you have better ideas you are welcome.

jscher2000

User avatar
 
Posts: 10077
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA

Post Posted November 12th, 2007, 3:14 pm

To exclude form fields from your script, try this:
Code: Select all
function disableselect(e){
  if (e.target.tagName != "INPUT") return false;
}

Note that IE uses windows.event.srcElement rather than e.target, but it appears you are not targeting IE with this method so I've ignored that for present purposes.

usmivkata
 
Posts: 8
Joined: November 12th, 2007, 1:51 pm

Post Posted November 12th, 2007, 3:27 pm

Great thanks! Works perfect!

usmivkata
 
Posts: 8
Joined: November 12th, 2007, 1:51 pm

Post Posted November 12th, 2007, 3:34 pm

The same script prints blank sheet on IE is it possible this also to be done for Mozilla?

np

User avatar
 
Posts: 301
Joined: October 18th, 2007, 6:31 pm
Location: Winnipeg

Post Posted November 12th, 2007, 3:36 pm

Just add a print stylesheet of
Code: Select all
body { display: none;}

usmivkata
 
Posts: 8
Joined: November 12th, 2007, 1:51 pm

Post Posted November 12th, 2007, 4:01 pm

np wrote:Just add a print stylesheet of
Code: Select all
body { display: none;}


May be I can't do something right, but looks like it does not work. Any ideas how to add also ctrl+a and ctrl+c copying?

Anonymosity
 
Posts: 8474
Joined: May 7th, 2007, 12:07 pm

Post Posted November 12th, 2007, 6:49 pm

As far as images go, someone can still capture a screenshot of the browser window.

jscher2000

User avatar
 
Posts: 10077
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA

Post Posted November 12th, 2007, 6:53 pm

usmivkata wrote:
np wrote:Just add a print stylesheet of
Code: Select all
body { display: none;}


May be I can't do something right, but looks like it does not work.

The suggestion is to create a new .css file (e.g., print.css) and add a new <link> tag to your document specifying that the browser should use print.css for media="print". For more information:

http://www.tufts.edu/webcentral/tutorials/printcss/
http://meyerweb.com/eric/articles/webrev/200001.html

usmivkata wrote:Any ideas how to add also ctrl+a and ctrl+c copying?

Not sure exactly what this means. You want to intercept these keystrokes and discard them? You can look at the script for this photo slide show for an example of how to capture key events for Firefox and IE:

http://jeffersonscher.com/thailand2005/food/
http://jeffersonscher.com/thailand2005/food/photoview.js

You would need to add detection for the Ctrl key. This article should help:

http://developer.mozilla.org/en/docs/DOM:event.ctrlKey
Last edited by jscher2000 on February 21st, 2010, 8:25 pm, edited 1 time in total.

usmivkata
 
Posts: 8
Joined: November 12th, 2007, 1:51 pm

Post Posted November 13th, 2007, 1:53 am

Sorry I could not explain it better. Actually I wanted to disable cthrl+a and ctrl+c functions in order to protect text and images from being copied.
In joomla based websites I do not think it is possible to add additional css file, so I have to add java script directly into the code.

Mordwin
 
Posts: 653
Joined: June 8th, 2005, 6:10 am

Post Posted November 15th, 2007, 3:51 am

Rather a pointless exercise then as in viewing your website I've *already* copied it...

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: Google Adsense [Bot] and 3 guests