Hide the status bar in Firefox - javascript

I would like to hide the status bar in Firefox when the mouse is over a link. Here is what the status bar is :
http://support.mozilla.com/en-US/kb/what-happened-status-bar
I already tried window.status with javascript but it doesn't work even if I set dom.disable_window_status_change to false. I didn't find any add-ons ever.
Does someone have a solution ?
NB : this is only for a web application which won't be published on the Internet, my goal is not to hide a target link :)
Thank you.

This won't be possible / allowed by the browser for security reasons.
If this is an absolute requirement, is specific to Firefox, and you control the web browsers for the users that will be using this application, you could write your own Firefox extension to do this for your specific site.

This will not work because this is built in for safety reasons.
To prevent phishing for example or other bad things you can do.
I mean I'm not sure but what you could do is leave the a href ="" tag attribute empty or just insert href="#" and add some javascript which redirects the user to the page you want when he clicks that link. But I'm really not sure if this would work in the way you want it !

You can't hide it when it is over a link, but one way to get around it would be to attach click events to span elements that change the window location. So they would act like links, but there wouldn't be a href attribute to show in the status.

Related

Web extension - alternative to notification with button

I have a web extension that lets any website access the clipboard. On request I will ask the user if it is okay to give access to the clipboard.
I do this in two ways
I create a notification
The problem: firefox doesn't allow buttons, so in the message I say "Click here to allow website x access". I added an eventlistener to the notification that sends a message back to the content script and it proceeds from there. It's okay but not really the best solution (I want buttons)
As a fallback I have a simple confirm box.
The problem: it doesn't really look good.
Now my other idea is to create a custom confirm box. That means create some html, css and javascript and append it to the DOM. This although is potentionally dangerous as websites can just trigger a "click" on the "allow access"-button then.
So I am basically looking for a nice and safe way to get confirmation from the user.
So what next? iframes? Is it possible to include an html page from the addon with access to a content script in an iframe?
Or is there some other way I can implement this maybe web extensions already offer something like this?
Completely overlooked the click event argument. There is a event.isTrusted property which is false when the event was triggered. (maybe not available in all browsers). But this pretty much solves the issue.

Can you make the browser detect Javascript links on elements other than <a>

On medium.com they have a clickable link on an h3 element, however the browser seems to know the URL that it will take you to and shows it in the bottom left side of the screen.
When I inspect element I see that this link is only an h3 element. It has a name attribute, an id and a class on it. There is no element and there is no href.
I assume that they listen to the click event of this element and then redirect the user to the correct page, but what I don't understand is how google chrome knows that this is a link and even shows the url it will take you to.
Is this something the browser now supports? Is there a specific way of forcing the browser to show it?
Yes, there is a <a> element, just further up the line:
This would have been visible in your screenshot too, in the selector bar at the bottom:
(Link to the page, if anyone is interested.)
Yep, it can be done through a simple listener, eg in jQuery:
<h3 id="link1">Link1</h3>
And the codebehind:
$("#link1").click(function () {
window.location.href = "http://www.google.com";
});
Should work in any modern browser, but I'd say they'd all interpret it differently. I'm not sure we really need to know why it works, just that it does - you could get in to asking how anything works in a browser. Presumably they quickly parse all of the code as it is loaded so they know all of the possible events. Something like this might help.
But if not Siguza finde <a href>. I think chrom count dependecis and show redirect page or function. Status bar you can just turn off or on. Or change by "wrong" redirect like can you show "Im the best" take
test
show : localhost34567/Im the Best! ---> ok not perfect :D but you can play with it and have better results.
https://superuser.com/questions/239202/turn-off-the-link-hover-statusbar-in-google-chrome

HTML: A way to prevent showing href in bottom left Google Chrome

Is there a way to prevent this to show up at the bottom left of a Google Chrome browser when hovering a with a href?
http://puu.sh/4lQDA.jpg
This is one of those things designed to protect users, it cant be controlled by the page being viewed as it would defeat the purpose. A similar question on super user suggests that it is not possible.
I am not sure if it solves your purpose .. but you could use javascript to redirect you to new page instead of using href if you dont want user to see link on statusbar.
<p onclick="go2URL('http://puu.sh/4lQDA.jpg')">click here</p>
<script>
function go2URL(url)
{
var win=window.open(url, '_blank');
win.focus();
}
</script>
Obviously u can use onclick even on any other html container as well .. this is just an example.
I dont think there is any direct way to disable status bar functioning.

Hiding statusbar using Javascript

How can we hide the statusbar of a current page using javascript.I used window.statusbar.visible = false but its not working.Please give me a solution
regards
Arun
I don't think you can hide it for an already opened window : it's not an element of the page, but an element of the browser's user interface -- which means it's outside of your concern.
(Even if you can open a new window that doesn't have a status-bar ;; which might not be liked that much by some users, btw)
Status bars are something people expect to see in every browser window. By not hiding it, you give users the first sense of safety that the content they see is still being served within a browser. You may be trying to simulate a desktop application experience on the web. But once you code for the web, you have to happily accept the standard elements that come with it.
Technically, no, you cannot hide the status bar after opening the window.

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