Hi,
I used a short code to pop up a thumbnail in a new window for a gallery view. The problem is I would like to disable the right click function on the popped up / new window. How can I do this?
This is the code i used to pop up the window:
<a href="#"><img src="sml/17.jpg" alt="Garden!" style="" onclick="javasc ript:window.ope n('lrg/17.jpg','new',' width=850,heigh t=650,resizeabl e=no,directorie s=no,toolbar=no ,scrollbars=yes ,left=12,top=0' );" width="72" height="71" border="0" /></a>
Thank you!
2 2068 acoder 16,027
Recognized Expert Moderator MVP
Welcome to TSDN.
I assume you know how to disable right-click, but need to access the new window. Put your code into a function and call that in the onclick of the link. When calling window.open, keep a ref. to the window: - var newWin = window.open(...);
then you can newWin to access the new window.
There are lots of scripts that let you disable right-click. Find them using a simple Google search. However, anyone determined enough will easily be able to bypass this 'security' measure.
hey try this
'Create a new page where the image will be placed. And popup this as the new window. Add this code in your script section of the popup page - function disable_right_click(e)
-
{
-
var browser = navigator.appName.substring ( 0, 9 );
-
var event_number = 0;
-
if (browser=="Microsoft")
-
event_number = event.button;
-
else if (browser=="Netscape")
-
event_number = e.which;
-
-
if ( event_number==2 || event_number==3 )
-
{
-
alert ("© ABC Co.Ltd. All rights reserved");
-
return (false);
-
}
-
-
return (true);
-
}
-
-
function check_mousekey ()
-
{
-
var mouse_key = 93;
-
var keycode = event.keyCode;
-
-
if ( keycode == mouse_key )
-
alert ( "© ABC Co.Ltd. All rights reserved" );
-
}
-
-
function trap_page_mouse_key_events ()
-
{
-
var browser = navigator.appName.substring ( 00, 9 );
-
-
document.onmousedown = disable_right_click;
-
-
if ( browser == "Microsoft" )
-
document.onkeydown = check_mousekey;
-
else if ( browser == "Netscape" )
-
document.captureEvents( Event.MOUSEDOWN );
-
}
-
-
window.onload = trap_page_mouse_key_events;
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: George Hester |
last post by:
In a page I have when the user left-clicks the page a Input box for a form gets the focus. But if the user right-clicks the page the Input box is not getting the focus. I'd like the Input box to get the focus no matter where on the page the user clicks be it right-click or left-click. Right now there is no context menu when the user right-clicks. Do you think that's the problem? Any ideas how to get this right-click left-click Input box...
|
by: dukeleto |
last post by:
I know this is an annoying thing on some sites.
I have set some images in an online gallery to have their own java po
up window that is set to be the same size as the image.
I would like to set ONLY the pop up window so it does not allow th
user to right click.
Now I did a search, and found some options, but when you right click
it gives the user an annoying pop up saying stuff like "you cant d
|
by: Robert |
last post by:
Can I programmatically disable the right click context menu?
|
by: lightzizo |
last post by:
All,
How can I disable or remove the close button in the screen.
thanks
|
by: Nalaka |
last post by:
Hi,
I suddenly started getting a lot of errors from html validation (some CSS)
so I followed the following instructions to disable it.
If you'd rather not have these types of HTML validation errors show up in
your error-list, you can disable this functionality by selecting the
Tools->Options menu item in VS or Visual Web Developer. Select the
TextEditor->Html->Validation tree option in the left-hand side of the
| |
by: surya52 |
last post by:
I want to disable right click in my application.Here are my requirements.
1. I don't what to turn off shift click for the page. I want to turn it off for specific links.
2. I want shift-click to be replaced with a regular click. Meaning, when the user shift-clicks the link they will be taken to the "HREF" within the current browser window and NOT open up a new window.
I did find a script that does something close to what I want, but it...
|
by: emmajoh |
last post by:
Hi
I'm trying to disable IE contextmenu (on a right click) as I want to
create my own.
The problem is that since I've installed the latest version of the
google desktop, the script doesn't work.
No other script I found on the Internet is working anymore.
As you can see below, I've tried to catch every event I'm aware of:
___________________________
|
by: hp_1981 |
last post by:
Hi
Is there anyway avoiding users to save my web pages?
this idea came to my mind when I tried to save a web page, but in the
middle of saving progress something like the following error occurred:
"unable to save the page...".
on the other hand, once, I saved a web page successfully, but when I
opened it the characters were completely unreadable. unfortunately I
can't remember the url now but if you know any way to restrict users,
|
by: TC |
last post by:
I don't use the Form Designer. Is there any way to disable it
completely? I find it annoying that every time I create a new form, or
double-click on an existing one, Visual Studio uses the Designer by
default. It would be nice if I could turn that off.
-TC
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |