Remove favicon using javascript in Google Chrome - javascript

How can you remove the favicon using Javascript in google chrome? The goal is to return it to the browser default, which is in this case a blank image.
I found this question, but it doesn't work if you leave the link.href attribute as empty.
Even if the favicon is set because there is a favicon.ico file on the server, I'd like to remove it and set it back to the default.
This only needs to work in chrome.
Thanks!

Have you tried using an empty transparent image?
Try:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oFFAADATTAuQQAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAEklEQVQ4y2NgGAWjYBSMAggAAAQQAAGFP6pyAAAAAElFTkSuQmCC

Putting those comments into answer form:
Suggestions:
chrome-resource://favicon/ or chrome://favicon/
Dynamic Favicon with AJAX
Chrome extension (hopefully you can base it off of this)
I'm a bit surprised the AJAX solution worked for you because, I'm on Chrome 4.1.249.1064 (45376) and it doesn't work for me.
EDIT: It doesn't seem like you'll need much from the AJAX solution. It seems that favicon.js is all you really need. All it seems to do is what the JavaScript solution you mentioned plus a little more handling (ie remove existing favicon). Their "dynamic" part is just a document.onkeypress.
EDIT: Additional reference:
chrome.tabs.executeScript
Whitelisting the favicon

As a combination of #MatthewFlachen's answer and what I found here: Dynamically generated favicon, one can dynamically generate a blank data url using the canvas API.
link.href = document.createElement("canvas").toDataURL("image/x-icon");

Related

A hyperlink download attribute not working

so i have this problem with hyperlink attribute download. basically i have link that download a certain file. however it doesnt work..
download file
With this format, it will download the file but it will give me an failed file says 'no file'.
On the other hand if i have link that has a complete uri format:
download file
It redirects me to the page and it will just show the file. The weird
thing is when I tried it on mozilla and brave browser. it works. but
in safari, and my default is google chrome. its not working..
Am I missing something? maybe in my header? really appreciate if you can help.. thanks!
EDITED
also, i've read this stuff about content disposition, so how do i know that my webpage set as inline for that matter.
it turns out, my problem is conflicted by same origin urls. Apprently, I am rquesting from different hosts/site, for further explanation see : https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
If you look at here https://www.w3schools.com/TagS/tag_a.asp
Scroll down to attributes, and you will see that the DOWNLOAD attribute is only supported by HTML5, which, as it seems, your friend's version of Safari does not support. I recommend updating the program.
Alternatively, you can right-click on the download link, then click Save As..., then download it that way.
This may also be caused js intercepting navigation and redirecting. If so, you may be able to work around it by adding a target attribute.
download file.txt

Really Need Advice Regarding Broken Links - Support team tells me it's fine

I just re-did a site, when I check it for broken links (using brokenlinkcheck), it comes up with 73 broken links that are all like this: www.example.com/site/numbers are here/${href}. Support over there tells me that (this quote is from one rep who got 'news' from another):
QUOTE: "did not find an issue. They had mentioned that the examples I showed were referring to tags with an attribute data-href that have the broken url. There type of links are not clickable and can not be visited and are mistakenly recognized by the tool as broken links. The link checker mistakenly alerts for 'data-href=...' (its not an href attribute)." END QUOTE
BUT, seeing the link in my email to them, I CAN click on it (why are they saying it's not clickable???). My main question is: will Google see this as broken links? Support is telling me there's no issue. But it looks like an issue to me. I cannot go in and fix myself, I would need specific wording to try and convince support to fix it. So, if you DO believe it is a problem, could you suggest how I word that in an email to support, who seems to think it is fine? Thanks so much for your help.
Without a URL to check it, or a sample of the html code, it is hard to say for sure. What the rep said does make sense, it is possible for the broken addresses to only be present in a data- attribute and therefor not to be clickable, Google would also not take these URLs into account while crawling the site.
Yes if you take the URL out of the data- attribute and paste it into an email it will be clickable but not clickable on your site. Again without a link to the site hard to say for sure.
Can you by clicking around your site get to and click the broken link? If not then it may just be a problem of the tool you are using.

Firefox failing at fonts

I know this is a common issue, but I haven't been able to solve this issue. I'm using Pictos webfont via tumblr as a CDN on this blog http://mrelliotb.tumblr.com/, however, in FF it does not render. I'm looking for a way to make it work and/or a way to detect the failure in rendering as to remove the extraneous letters that should be rendered.
Thanks in advance!
Check the comments on the accepted answer in this thread. It deals specifically with your problem:
CSS #font-face not working with Firefox, but working with Chrome and IE
In a nutshell, Firefox does not like the cross-domain hosting for the fonts, and you should base64 encode them directly in to the stylesheet
You can easily base64 encode your font by using this wizard and selecting advanced/Base64 encode.
http://www.fontsquirrel.com/fontface/generator
from my browser, your font now is helvetics and not pictos web font. did you have some #font-face at your stylesheet? and second, if it is problem with firefox you just have to make sure your config at
option->content-> advance button at font -> make sure your the setting is allow the web render its own font
may this help

jQuery Gallery will show locally on Firefox and Chrome but won't work online

I tested a jQuery-gallery locally in every browser available. Worked like a charm. However; when i upload everything to my server it won't load properly. Looked in the source but couldn't find the flaw.
Any ideas?
URL: http://www.pastisamsterdam.nl/proto/impressie.html
The problem is not your server, is your paths.
The folder /proto/Images/impressie/ does not exist on your server, but /proto/images/impressie/ is, this means you have a unix based system which is case-sensitive.
Change the images path to /proto/images/impressie/ and your script should work.
Use Firebug for these kind of problems. Path (http://www.pastisamsterdam.nl/proto/Images/impressie) to your images is not valid, that's why they are not loaded.
Change Images to images and it will work. Because your server is case-sensitive, I think :)
Happy coding ^^
Update the image src to link to the correct url, if you posted the actual path to the image, i can tell you the src for the image.

Javascript: Workaround needed: Internet Explorer changes link text when changing the href

I have a problem as follows: We're using a rich text editor (TinyMCE, but that's not important here, I think) in our application. Now, with Internet Explorer 8, we've noticed that if you type in content that looks like a web address:
www.google.com
...IE helpfully converts it to a link by some native-to-browser functionality. Now if you really want to make it into a link, and choose to edit link properties, and set the href e.g. to
www.google.com/analytics
...then when the javascript sets the href attribute of the anchor tag, also the text of the link changes. The desired result is:
`www.google.com`
but actually is:
`www.google.com/analytics`
Does anyone know a way to work around this?
Update: This behavior has only been observed in Internet Explorer 8 and 7. Firefox, Chrome, and Safari are not affected. The problem can also be observed on the TinyMCE websitehttp://tinymce.moxiecode.com/examples/full.php, so it's probably not a TinyMCE configuration issue.
After some research and debugging, I found that the problem is caused by built-in behavior of Internet Explorer. It occurs when setting the href-property of a link, whose text-content appears to be an URL (according to IE). In these cases, IE copies the contents of the href-attribute into the link text.
There might be several workarounds for this, but I found that at least this logic works:
store the innerHTML into a temporary variable,
set the href attribute as usual
if innerHTML has changed, copy back the original innerHTML from the temporary variable.
This seems to work because changing the innerHTML of the link does not cause changing of the href attribute.
In tinyMCE, find the following line in setAllAttribs() of functions.js of the advlink plugin:
setAttrib(elm, 'href', href);
...and replace it with this monster:
if(tinyMCE.isMSIE) {
var tmp = elm.innerHTML;
setAttrib(elm, 'href', href);
if(elm.innerHTML != tmp) // optional, but keeps unnecessary innerHTML set:s away
elm.innerHTML = tmp;
}
else {
setAttrib(elm, 'href', href);
}
...and your links will appear as if untouched. I also started a thread on the tinyMCE forums about this. If they post some improvements to my solution or tell it's nonsense, I'll update this question also.
Need more information:
Does it behave the same way in other browsers?
Are you typing this into the rich text area, or the html view?
Have you configured TinyMCE properly? Sounds like a bug with your particular implementation -- it is not parsing out the HTML tags properly.

Categories

Resources