| | |
How to apply No right click script inhere...?
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2008
Posts: 51
Reputation:
Solved Threads: 0
Hi
I built a html page with a single button which suppose to open new window which shows XML file...
I want to disable right click mouse in the "new window" which is being opened after button hit...
I do know how to disable the right click inside an ordinary html page : "<body oncontextmenu="return false;">"
but how can i do it in the new opened window... i tryed several ways but without luck
:/
here is the code:
Thanks ahead.
Daniel.
I built a html page with a single button which suppose to open new window which shows XML file...
I want to disable right click mouse in the "new window" which is being opened after button hit...
I do know how to disable the right click inside an ordinary html page : "<body oncontextmenu="return false;">"
but how can i do it in the new opened window... i tryed several ways but without luck
:/
here is the code:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <body oncontextmenu="return false;"> <script language="javascript" type="text/javascript"> function showExternalXml(){ w=800 h=800 l=200 t=200 globalHTML="<html><head><title>name.xml</title></head><frameset rows='100%'><frame src='c:\\dir\\name.xml'></frame></frameset></html>"; window.open("javascript:opener.globalHTML",'HeavyXml',',resizable=1,width='+w+',height='+h+',left='+l+',top='+t+''); } </script> <table border="1" style="cursor: pointer "> <tr> <td bgcolor=#CCCCCC> <input type="button" value="Display Xml" onclick="showExternalXml() "style="cursor: pointer "> </input> </td> </tr> </table> </body> </html>
Thanks ahead.
Daniel.
Last edited by vedmack; Apr 10th, 2008 at 9:46 am.
AFAIK, the
oncontextmenu is not supported across all browsers. But still if you want that kind of functionality, create a new HTML page which would be popped to the user when he clicks on the link. Inside that page instead of loading the XML document in a frame, load it in an iframe . That way you can have a body element inside your newly created page which can have the attribute oncontextmenu set as false . I don't accept change; I don't deserve to live.
•
•
Join Date: Feb 2008
Posts: 51
Reputation:
Solved Threads: 0
•
•
•
•
Stop trying to take over the user's computer.
It belongs to that user, NOT TO YOU!
If you want to protect your pages from things the user can do, then DON'T PUBLISH THEM ON THE INTERNET!
Listen...
All I want to do it to prevent the user from accessing to the source of an XML files I'm showing to the user... I don't want to revile the user the info of where the xml is locked on the network... (view source on xml opens it in notepad which by clicking "save as" gives the full path of the xml file to the user...)
thats all....
Relax... its all gonna be alright....
Last edited by vedmack; Apr 13th, 2008 at 1:21 am.
•
•
Join Date: Feb 2008
Posts: 51
Reputation:
Solved Threads: 0
•
•
•
•
AFAIK, theoncontextmenuis not supported across all browsers. But still if you want that kind of functionality, create a new HTML page which would be popped to the user when he clicks on the link. Inside that page instead of loading the XML document in a frame, load it in aniframe. That way you can have abodyelement inside your newly created page which can have the attributeoncontextmenuset asfalse.
I tried ~s.o.s~ suggest...
Here:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <body oncontextmenu="return false;"> <iframe src='c:\name.xml'> </iframe> </body> </html>
but the no right click does not affect the iframe... I still can press right click inside the iframe...
any other ideas?
That's because the right click is part of windows, not your web page.
You don't have the right to prevent it. It belongs to the owner of the computer.
What could possibly be in the XML content of a file that you want to hide?
If you are afraid that someone will steal a programming technique you devised, then put a notice in that programming.
If the user is viewing the rendered file, the file is on the user's computer disk already. He can get it with My Computer using the start button, and you can't do anything to prevent that.
You don't have the right to prevent it. It belongs to the owner of the computer.
What could possibly be in the XML content of a file that you want to hide?
If you are afraid that someone will steal a programming technique you devised, then put a notice in that programming.
If the user is viewing the rendered file, the file is on the user's computer disk already. He can get it with My Computer using the start button, and you can't do anything to prevent that.
Daylight-saving time uses more gasoline
•
•
Join Date: Feb 2008
Posts: 51
Reputation:
Solved Threads: 0
•
•
•
•
That's because the right click is part of windows, not your web page.
You don't have the right to prevent it. It belongs to the owner of the computer.
What could possibly be in the XML content of a file that you want to hide?
If you are afraid that someone will steal a programming technique you devised, then put a notice in that programming.
If the user is viewing the rendered file, the file is on the user's computer disk already. He can get it with My Computer using the start button, and you can't do anything to prevent that.
All i wanna do is somehow hide the full path of the presented xml that are actually stored on some network drive...
Any ideas ono how to do it?
•
•
•
•
I tried ~s.o.s~ suggest...
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <body oncontextmenu="return false;"> <iframe src='c:\name.xml'> </iframe> </body> </html>
First off you cannot link to c:\
Unless name.xml is on every users computer nothing will show there.
Saving the file does not reveal the files location, its probably just that you have the src wrong.
Lastly, its not possible to completely block the rightclick.
•
•
Join Date: Feb 2008
Posts: 51
Reputation:
Solved Threads: 0
•
•
•
•
First off you cannot link to c:\
Unless name.xml is on every users computer nothing will show there.
Saving the file does not reveal the files location, its probably just that you have the src wrong.
Lastly, its not possible to completely block the rightclick.
1) actually its on a network drive.... (c: was just an example)
2)when file is being viewed with internet explorer it is possible to right click and choose "view source" on xml which opens it in notepad and by by clicking "file->save as" gives the full path of the xml file to the user...(z:\foldername\name.xml) <-- i wanna hide this path...
3)its an webapplication.. not some simple website...
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Editing client side registry
- Next Thread: Displaying all object properties
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxjspservlets automatically beta browser bug captchaformproblem cart checkbox child close codes createrange() css cursor debugger decimal dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html ie7 ie8 iframe index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select shopping size software sql text textarea unicode w3c windowofwords windowsxp wysiwyg \n






