Disable & resize IE - javascript

I have a few questions in mind...
I want to disable right click on my webpage so that noone can alter
the source code
I want to disable the addressBar as well
I wish to resize it to a particular size in the bottom right of my
screen & with a text area so that when ever I click the button
inside that webpage all the contents in that text box should be
copied
I tried experimenting but it doesn't seem to work, javascript maybe has some issues.
I wan't it purely on javascript & HTML (Can't use php/asp), want it to work on IE only, dont care about other browsers....

1) I wasnt to dis able right click on my webpage so that no one can
alter the source code
Regardless of browser hackery employed, the user will always be able to view your source. Nobody will ever be able to alter the source code on your server (short of the server being hacked or a vulnerability in your code is found). But, using Firebug (or similar), anyone can change client-side script, CSS and/or HTML.
2)I want to disable the addressBar as well
You can't just gain full access of a browser. That would get annoying pretty quickly (think about the potential browser-inducing epilepsy if every site had control over your root browser and did different things to it). One thing that you could do is have your site create a popup window that is set to a specific size with specific attributes (hiding the address bar, etc). Note that you may annoy users with this as you'll have to deal with popup blockers and such.
3)I wish to resize it to a particular size in the bottom right of my
screen & with a text area so that when ever I click the button inside
that webpage all the contents in that text box should be copied
I have no idea what this means.
Was this post a troll?

You can't disable the address bar with JavaScript.
However you can disable right click. Note: Anyone with enough technical background to know what to do with the source code would know enough to just disable JavaScript to get their right click working.
Here's a demo with source code to disable right click.
Demian's answer has some good insight on what you're asking, I strongly suggest you rethink what you're doing.

Related

How to disable / hide and alter some elements in CK-editor image pop-up

I have a VB forum that uses the CK editor which is amazing, but there are many features on the editor that simply confuse my members, most specifically in the image upload/attachment popup. I would like to simplify the popup by hiding some of the elements and changing some text descriptions. I asked for help on the VBulletin website, but because this is a plugin for their software, they don't really have much advice to help me accomplish what I would like to do. So, I thought I would go to the source.
This is what the pop-up looks like currently:
enter image description here
I made a mock-up image of what I would like the image pop-up to contain. I would want my forum logo to display instead of the VB logo or just have no logo there at all if it is too complicated.
enter image description here
I looked at the JavaScript for the popup and it was way too complex for a novice like me to begin to edit without detailed instruction. So, I thought maybe I could hide the unwanted elements using CSS. It looked good but still has a big footprint. Here is what I came up with:
enter image description here
The way I accomplished this was with the following CSS code:
enter image description here
This CSS edit works great on the desktop site, but the fields return if I visit the site on my mobile device. I put my browser into developer mode and chose the different phone and tablet settings and the hidden elements re-appear. I inspected the containers that I hid and the numbers are the same. For some reason, they show even though they are hidden by CSS. When I go back to the desktop browser, the elements are correctly hidden again. I thought maybe it was a browser cache issue at first, but it happens in both Firefox and Chrome as well as the internet browser on my phone and chrome there as well. I was able to get it to work like I described using the Firefox browser, but when I switch to Chrome browser, all the hidden elements reappear. :(
Anyway, I'm out of ideas on how to solve this issue on my own. So, my question(s):
Is there a way that I can edit the CK editor plugin to accomplish the simple pop-up I want for my site?
If so, can someone supply the correct code and the JavaScript file name I need to edit?
I would be most appreciative for any guidance. Thank you, sincerely.
Kether

Is it possible to inject HTML into a website to force-enable scrolling?

Okay, so this is a bit of an odd question. Facebook is trying to remove the feature that hides your profile from search, but requires you hit an accept button before they can remove it. I like my privacy, so instead I just used ABP to hide the dialog box and give me back access to the page. The problem is that scrolling has been disabled, so while I can interact with the content that's currently visible, I can't scroll down. Is there a way to inject HTML or JS that would force-enable scrolling?
Seems as a job for greasemonkey
https://addons.mozilla.org/sv-se/firefox/addon/greasemonkey/
There are similar plugins for other browsers, Chrome have support for users scripts by default but there is a great addon there as well
https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
Internet Explorer can also offer this by adding Trixie
http://trixie.softpedia.com/
If you don't need it all the time and don't want to go to the effort of making a script you could just edit the html directly using either the developer tools built in to most browsers and inspecting the element.
Just right click what you want to change and select inspect element.
Adam

ASP.NET - Opening a PDF and detecting that the user scrolled to bottom

I need to load and display a PDF in an ASP.NET/Javascript application and detect when the user has scrolled to the bottom and trigger some javascript function at that point. What would be the best way to implement this?..
Thanks in advance
Here is a better alternative, Put some text at the end of the PDF, like a code. Make them enter that code into a textbox. Or even better, why use a PDF at all? Just output the text directly on the page. If a PDF is a must and it cannot be changed, I remember the anti-piracy scheme with my old video games was to enter the X word on the Y page in the Z paragraph. I still have my original Warcraft manual.
While exactly what you want to do is somewhat possible, it will be very brittle and error prone. Don't do it. You would be alienating your non javascript users (not that there are that many) but even worse, making this reliably cross browser and cross OS will be a pain in the ass.

Disable Clipboard & Print Screen on webpage

i search online but can't get satisfactory result
i want to protect images on my website, i know i can disable save as, right click.
the real question is can we Disable Clipboard & Print Screen with JQUERY or java script.
so no image copy from print screen.
thanks
Not from a webpage.
Even if you were able to disable these from within a browser, it will only stop a casual user. If you make a resource available on a public server (as you must in order to let a casual user view it), there really is no way to stop someone from retrieving that resource. After all, you actually want the user to retrieve the resource.
No. I am pretty sure you can't do that. Print screen is a part of the OS, not the browser. I would hope that web sites weren't able to mess with my OS like that.
You can certainly throw roadblocks in front of people trying to download an image, but short of watermarking, there isn't a great way to prevent people from getting your image (that I know of) if you make it available online.
No you can´t. And you can´t disable right click in a bullet proof way either.
The only way to protect your images is by watermark them.
Print Screen is a function of the operating system, and as such, cannot be disable by a webpage.
Actually, you can't disable anything. I know you technically can, but most browsers have an option to not allow disabling of those things. And really, worst case scenario, anyone can view the source of your site and copy the image's url.
In short, don't worry about it so much. Some people will copy your images, but this is nothing new on the internet, so you'll just have to learn to live with it. The only thing that any of your work will do is annoy some people, and make other people have to try a little bit. So, it's really best to not do anything. Place a copyright notice on your site and most people won't try to blatantly steal from you.
The only way to do what you're requesting is to incorporate OS-embedded DRM into your content (think HDCP). This can prevent even screenshots from being done but will severely limit your audience and is an absolutely horrible idea - don't do it!
If you really want to protect your images, the best way to do it is with watermarks and providing very low-quality images on your website and the high-quality stuff in some other way. The watermarks aren't a perfect solution but many consider them good enough.
Well there is no direct way to do that, but I used javascript to hide the content whenever the user hovers outside the website. This forces the user to actually activate your page to be able to see its content. This will activate the javascript that prevents prnt scrn too.

Creating new tab / switching between Tabs in Firefox?

I am looking for a way to improve the workflow in a PHP based CMS. There is a lot of switching between the editor mode and the preview mode of the page. The editor mode is huge to load, and so I would like to open the preview mode in a different window.
I don't want to use new windows or an iframe within the current window to keep the workflow simple and to avoid confusion.
Is there a way to explicitly open a new tab (not window), and to jump to that tab from a document, in Firefox? The number of users is limited, so there is the possibility to set up the client with the necessary extensions / permissions.
I know Firefox can be forced to open all links in tabs, but I think that won't cut it, as I still can't address and focus the newly opened window.
Thanks for all the great answers everyone. I have now enough material to decide whether I'll take the greasemonkey approach, rely on the user to set up "open in tabs" and address the window by name, or use a "inline" HTML solution as so many of you suggested. I am accepting the answer that I feel went most effort into.
There is no way to force a window to open as a tab. It's all dependent on the user's preference settings.
I second the answers that say you should do this in HTML using Javascript. Then it can work in all browsers that support JS.
I would put two divs on the page and show/hide each div depending on which tab is selected. If you are clever about this you could trap the click on the tab and determine if the user left-clicked or middle-clicked. If they left click you load that tab on the page. If they middle-click you let the browser open a new tab/window (according to the user's prefs, don't try to force it), and leave the current window unchanged (that is, don't switch to the new tab). The action for clicking on the tab would be to use AJAX to load the contents of the remote document and put it into the tab. Use Javascript to modify the URL before submitting the AJAX request so that the server knows to send a web page fragment instead of the whole page.
The advantage of this dual-natured solution is that the tabbed approach will work the way you want it to work for the majority of cases, but for users with, say, two screens, or who prefer switching between browser tabs, they will still have the flexibility to work in multi-window mode. This can all be done without any browser extensions and it should work equally well in IE as well as Firefox, Opera, etc. Avoid locking yourself into one browser, even one as excellent as Firefox. One day a customer will need to use Opera or Safari and you'll be stuck.
You say you don't want to use an iframe to avoid confusion. Now I don't know about the layout of your website, but I've been using the approach that the editor opens in its own div right next to the content being edited and the content is being live updated as you edit. No need to change tabs.
(If the window is too narrow there are HTML tabs Edit and Preview)
It does not seem to add confusion to the user and for me this approach works really well. Maybe it's worth considering in your case.
What about using iframes and JavaScript?
I know you said you want to avoid 'confusion using iframes', but in my opinion if you really need to load different pages at the same time this is the best option.
In theory, you could create your own tab system using javascript or even better, using jQuery, because its UI module offers pretty cool tab control.
For every tab you could load separate "headerless-footerless" version of your specific admin page inside <iframe> element. If user wanted to modify something different, he will simply click on the tab and bring different iframe.
All this could also be done using AJAX, but iframe solution is quite easy as you just need to load ready page and all postbacks are already handled by original page and separated from master-admin-page.
You might also need to play a little bit to set correct height of your iframe to fit all the content without scrollbars, but this again, is just bit of javascript.
Nope, there's no way to force the opening of a new tab, simply because this would be unsupported by un-tabbed browsing
You can only set it to open a new window, not a new tab.
Greasemonkey springs to mind - a quick google gives open in tabs on left click. I think you could modify that so it only runs on one particular page, and you'd be up up and away.
This question made me wonder if HTML 5 allows that sort of specification, and it doesn't (nothing in one of the other hyperlink attributes, either). A new browsing context is a new browsing context, there's no way to express a preference for tab over window or foreground over background.
You can't force a tab, but if you use a target with a specific name, like target="my_cms_window", many browsers will open this as a new tab. Additionally, they will remember the name and if you use the target repeatedly, put the contents in the same tab. I have found that this works pretty well in the real world.

Categories

Resources