disabling URL (not to be copied) in firefox using Javascript - javascript

I want to ask that how could i restrict the user not to copy the URL displayed in firefox. One option is to Disable the URL not to be shown to the user
other one is to Disable the address bar so that the URL can be seen but cant be copied.
But i dont know how to achieve any of these using javascript.
Any help along with code snippet would be highly appreciated.
Thanks in advance

You have absolutely no control over that portion of browser UI.
This cannot be done. Not via javascript, and probably not through any other legitimate means, either.

You can open a new window without the address bar using the window.open method.
But
certain browsers (think mobile...) don't support hiding the address bar
users can possibly disable this feature in their browser settings
there is always more than one way to copy the URL, not only from the address bar

Related

To hide the address bar in popup window by setting disable_window_feature.location value to false

I need to Hide address bar in Pop up window(Security reasons). i used
window.open(“res.html”,“mywindow”,location=0,menubar=0,status=0,scrollbars=0,width=100,height100″);
in my JavaScript Which is working fine. But, for mozilla we need to set Dom.disable_window_open_feature.location value.
In Web application how can i set this in users firfox browser? Is there any way to set this using java script. I want setDom.disable_window_open_feature.location value using JavaScript before i use window.open. How can i do this?
You can't hide it, and even if you could, this would almost certainly provide no security for your application as it could be simply overridden.
The reason any up to date browser will not allow you to hide the address bar, is actually for security/anti-phishing reasons itself. If the address bar was hidden, and you included a popup window (for example to a bank's customer page), and you made a site that looked like the banks login page to capture their customers details. Since the address bar is forced to always be shown, the end user would instantly see the domain was not from their bank.
If you give some more information as to why you have a security requirement to hide the address bar, maybe we can provide an alternative method to help you.
Intelekshual gives a good explanation in the post here, but note this will only work for your local machine, and not other web users:
Firefox 3.0 and higher have disabled setting location by default.
resizable and status are also disabled by default. You can verify this
by typing `about:config' in your address bar and filtering by "dom".
The items of interest are:
dom.disable_window_open_feature.location
dom.disable_window_open_feature.resizable
dom.disable_window_open_feature.status
Also have a look at the Mozilla documentation for window.open to get the official information.
In Firefox 3, dom.disable_window_open_feature.location now defaults to
true, forcing the presence of the Location Bar much like in IE7. See
bug 337344 for more information.

How to generate a pop up without the address/title bar on clicking on a link?

I have this email campaign running which sends out a link to the subscribed users which opens up a pop up window(with the url) giving away a code which the users can use to avail discounts. The url can be copied thus generating another code which can be misused. Is there a way to generate a pop up without the address/title bar for IE,Chrome,Mozilla ?
There's no guarantee that any given browser will support it or that the implementation will be consistent across browsers.
This link indicate that the location option should control whether or not the Location/Address bar is shown. It should also have relatively good cross-browser support.
This LINK also helps you in hiding address bar.

How to disable the url address bar using javascript or jquery

I've got a spring mvc framework and I want to disable the url address bar when the page loads! (It's not a public web application) How can I achieve this using javascript or jquery.
Update :
Guys, If I can make the url bar read only that would be okay too!
One potential workaround is to create a simple WPF app that hosts a web browser control that fills up the entire form. The web browser control does not have the url address bar,so you can simulate what you're describing using this approach. Might work since you said it's an internal application.
Note: The browser control will behave like IE
You cannot hide the address bar in your browser programmatically.
You can hide the address bar in browser windows opened by your javascript code, although I think some browsers are even overriding this now too.
I am afraid this is mission Impossible. You can't hide something that is directing you. The link on webpages are all visible. The concept to hide url is to making them non understandable. Encrypt the certain portion of the url like id, slug ...
You can make location bar readonly only if you are using window.open.
In case of IE, we can change the setting of browser for this. But this may not be good idea.
so for just disabling location bar by using window.open, the code is as follows:
subwin = window.open(url,"dummyname",'width=635px,resizable=no, height=535px, menubar=no, toolbar=no, location=no, scrollbars=no');
In the example above, location=no disables the location bar.
You can change the value of size,scrollbars, menubar etc. as your choice.
Thank you.

add bookmark in Firefox without any dialog box

Using JavaScript, is it possible to add a bookmark in Firefox directly, without opening any dialog box? That is, I want the user clic on a link and that the bookmark is automatically created, without the need to any further step.
Fortunately, no. It would be a horrible breach of security.
Could be a different story in the context of a Firefox Extension, but I assume you are asking for a normal web page.
If it was possible, any possible website would be able to create any kind bookmark, without the user even noticing.
As a user, I certainly hope this is not possible ^^
(And, as a developper, I don't think it is)

Responding to address bar key events in Firefox Add-on

I want to write a Firefox addon that could get the content of the address bar in real time, for example this addon will change every "a" to "A" just as the user pressed "a".
The problem is that I couldn't find any way to do that in Javascript, is there a way to do it (getting the address bar content in real time)?
You didn't actually say at what point you're stuck.
First you need to create a simple extension that overlays the main browser window (browser.xul). Building an Extension - MDC, URL Fixer - good example extension
Then you'll need to attach an event listener to the URL bar (key words: addEventListener, events). You'll probably want to listen for "keypress", although you should read the documentation on various events available. You can search through Firefox or other extensions' source to see what element they attach the listener to. You can inspect the DOM tree (to see the elements available) in the DOM inspector extension.
In the event listener you should check and update the URL in the Location Bar (gURLBar.value, IIRC). You'll also have to do something to preserve the caret position.
Don't hesitate to ask for help in the forums listed at https://developer.mozilla.org/en/Extensions
A Firefox extension can absolutely control the address bar. Try looking at the source code for the omnibar extension. (To get at the source code, install the extension and then poke around your Firefox profile folder)
You may need a listener to track urlbar changes such as:
gBrowser.addProgressListener(myExt_urlBarListener,
Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
The urlbar can be updated by this command:
document.getElementById(comVar.URLBAR_ID.gui).value
You will need to detect each keystroke with Javascript by reading the url with the above code. If you need more details then extract and check out the code in one of the spoof addons for firefox.
If you are simply trying to modify the text of the address bar without redirecting the user, this is not possible.
Whenever a property of the location object is modified, a document will be loaded using the URL as if window.location.assign() had been called with the modified URL.
If the browser allowed you to use javascript to change the string in the address bar without redirecting the user, it would be prone to phishing. That's not what you're trying to do is it?
In JavaScript, window.location.href will give you the value, and you could watch for it onkeyup, but AFAIK, you can't write back to the location field without loading the page at whatever value you set it to. What I mean is, if you did the following, it would reload the page:
window.location.href = window.location.href.toLowerCase();
I'm not familiar with how Firefox extensions work, but maybe there is a more "native" way to do this?

Categories