Discuss Disable right button mouse? in the JavaScript Development forum on Dev Shed. Disable right button mouse? JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
Posts: 19,834
Time spent in forums: 6 Months 1 Day 21 h 3 m 17 sec
Reputation Power: 4192
Are you sure you want to annoy your users? There are usually ways to get around whatever it is you're trying to block. Some browsers even have an extension that disables right-click-blocking scripts.
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.
Posts: 7
Time spent in forums: 2 h 13 m 17 sec
Reputation Power: 0
Quote:
Originally Posted by Kravvitz
Are you sure you want to annoy your users? There are usually ways to get around whatever it is you're trying to block. Some browsers even have an extension that disables right-click-blocking scripts.
Posts: 605
Time spent in forums: 1 Week 1 Day 16 h 18 m 24 sec
Reputation Power: 69
I have one idea, but it would involve not being able to access the content in the iframe (which your probably going to want to be able to access, so you may not want to do this) and you would have to set the iframe width and height; to the size you want to display it at, because you could not access the scrollbars either. That would be the main drawback for you to have to deal with. You could use a transparent GIF and CSS to cover the contents of the iframe and set the GIF oncontentmenu event to return false.
This idea would only be good, if you just are basically wanting to have the page view-able through a figurative window. This is an old advert idea/concept; that is still commonly used by online advertising/marketing companies, such as PointRoll. Otherwise, my advice would be to scrape the content, of the page, your putting in your iframe and display the scraped content back into your page in an element, like a div. Then set-up your CSS for this div; with a specific height and width. Then set the overflow to auto and/or give it a border. This would give the impression of a iframe and if someone tried to open a context menu, the content would be in your page; so it would look like it's your content, but maybe that would not matter to you, either way. Assumingly, your not wanting someone to see your source code, because your not wanting it to be stolen, but their are several ways around this. So basically and overall..., I would have to agree with Kravvitz.
Posts: 7
Time spent in forums: 2 h 13 m 17 sec
Reputation Power: 0
Quote:
Originally Posted by web_loone08
I have one idea, but it would involve not being able to access the content in the iframe (which your probably going to want to be able to access, so you may not want to do this) and you would have to set the iframe width and height; to the size you want to display it at, because you could not access the scrollbars either. That would be the main drawback for you to have to deal with. You could use a transparent GIF and CSS to cover the contents of the iframe and set the GIF oncontentmenu event to return false.
This idea would only be good, if you just are basically wanting to have the page view-able through a figurative window. This is an old advert idea/concept; that is still commonly used by online advertising/marketing companies, such as PointRoll. Otherwise, my advice would be to scrape the content, of the page, your putting in your iframe and display the scraped content back into your page in an element, like a div. Then set-up your CSS for this div; with a specific height and width. Then set the overflow to auto and/or give it a border. This would give the impression of a iframe and if someone tried to open a context menu, the content would be in your page; so it would look like it's your content, but maybe that would not matter to you, either way. Assumingly, your not wanting someone to see your source code, because your not wanting it to be stolen, but their are several ways around this. So basically and overall..., I would have to agree with Kravvitz.