How to disable firefox's reader view from my website? - firefox

Today i updated my firefox to the latest version and one big feature is the reader view for desktop. We launched a webshop two weeks ago and now there is this tiny "reader view" icon. When i click on it i get an error-message. My team-leader wants me to remove this feature when visiting this site.
is it possible to remove or hide the "reader view" feature from firefox when visiting my site?

There is currently no legit way of disabling Reader View for your website. Reader View is supposed to automatically detect on what pages it should be available and on what pages it should not.
If there is an issue with your website, your best option is probably to report it there: https://github.com/mozilla/readability/issues
You can also find more info about the issues affecting Reader View in Firefox there: https://wiki.mozilla.org/QA/Reader_view
Although I would not recommend it, there might be a way to fool Reader View into thinking it should not parse your website, if you really need to. A quick look at the source code reveals that it will not parse certain type of documents, certain URIs and malformed URLs. You would need to dig in the source to understand how/if your site can safely be adapted to avoid being parsed. The Reader View source code can be found here: https://mxr.mozilla.org/mozilla-release/source/toolkit/components/reader/ReaderMode.jsm or
https://dxr.mozilla.org/mozilla-release/source/toolkit/components/reader/ReaderMode.jsm

This Question shows how to Optimize website to show reader view in Firefox. So you have to ensure that your site is not optimized for the Reader View.
Don't use formatting options that are favoured for the Reader View and so on.
I guess this will suffice:
Don't use the <p> Tag
write all Textblocks in small portions
Here are some more details about the mechanism

Replace p tags with div tags in your page. It worked for me, even when I have div tags with pre tags (preformatted text) on the same page.

There is no way of forcing disabling the Reader View to the user, But if it is important to your site, you can notify the user to disable or not use the reader feature of firefox.
This would be the way to Disable the Reader on the users browser
in the Enter about:config in browser address bar
click the "I'll be careful I promise" box
search for reader.parse-on-load.enabled
toggle preference to false (right click > toggle to false )
close the about:config page > refresh browser > reader view icon has gone

put this code on your css code and you are done !
/* CSS Reset */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,
p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,
img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,
dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,
thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,
footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,
audio,video,adnav,adheader{
margin:0;
padding:0;
border:0;
font-size:100%;
font:inherit;
vertical-align:baseline;
}

Related

how to enable Safari Extensions when using a web view

I am using a Web view in my application, instead of open a Safari browser instance, so I noticed that Safari extensions doesn't work. Is there a possibility to enable this feature when using a custom web view in a Cocoa Application?
The reason by which I need to use Safari extensions is to inject javascript to whatever web page is loaded at one moment, so if is there another approach to do it without using extensions, welcome any suggestions or samples.
There's no way to use Safari extensions in a web view.
If your script isn't too big, how about formatting it as a "javascript:" bookmarklet and setting the web view's location to it?
[Edit: Stuff below added in response to questioner's request for "a bit more about that technique".]
Say you want to change the background color of the page to yellow and all the text to red. The javascript to do that would be something like:
document.body.style.backgroundColor = "yellow";
document.body.style.color = "red !important";
To turn the script into a bookmarklet, you just:
Wrap it in an anonymous function,
remove all line breaks,
(optionally) remove any unnecessary spaces,
url-encode it,
and prefix the whole thing with "javascript:".
So, the example would become:
javascript:(function(){document.body.style.backgroundColor%3D%22yellow%22%3B%0Adocument.body.style.color%3D%22red%20!important%22%3B%0A}());
Then you can set the webview's window.location to that string to "run" the bookmarklet.
Here is a page with an automatic script to bookmarklet converter that seems to work.

Gecko WebBrowser, getting the url from a selected hyperlink

This is a real 2%er but here goes, I have created a winform in VS2010 with Gecko 2.0.1-0.10 (latest release) webbrowser control, I am using a touch screen to navigate. Sometimes when clicking a hyperlink it will select text rather than navigate, on the DomMouseUp event I want to check to see if there is selected text, if so I want to see if it is a hyperlink and if it is, where that hyperlink goes to. I had a mess around with GeckoSelection but nothing looked obvious. I am looking for a way to see if what is selected within the web browser is a hyperlink, any thoughts?
I've worked it out : for anyone interested in such things, use DomFocus on the gecko control:
m_strInnerHtml = geckSel.ActiveElement.Parent.InnerHtml.ToString();
That will give you the innerhtml of the selected item, from here you can extract the href tag and get the url, navigate to it, hey presto :)
Update: An even better solution is to use (in DomFocus again)
m_strInnerHtml = geckoWebBrowser.Document.ActiveElement.GetAttribute("href");
This will return the actual hyperlink address, one thing to watch out for however is if you're on google for example and select the "Advertising" hyperlink at the bottom of the page, it may return "/advertisingpage/" which must be appended to the original url. Clicking a hyperlink away from google will return the full address however.
Very good behavior gives this call:
m_strInnerHtml = geckoWebBrowser1.Url.AbsoluteUri()

How can I create a page like Add-ons Manager with urlbar and toolbar hidden at Firefox 4 extension?

When browsing the Add-ons Manager, about:addons, in Firefox 4, the toolbars and urlbar are hidden when "Tabs on Top" has been set.
As I am writing an extension in bootstrapped method, how can I simulate that feature in my own created page?
It has already linked to a page on resource scheme (resource://app/page.html)
I am wonder if there are some "hidden" attributes that can easily do such kind of things.
Or, whether it must hide and show the urlbar and toolbars in listener of window-mediator.
Solutions in XUL method are also welcome :) , but it'd be better if it can easily handle in bootstrap.js. ;-)
Thank you for your help.
It looks like Firefox maintains a whitelist of URL locations that should hide the locationbar chrome. The whitelist is checked here:
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#4412
So, setting the "disablechrome" attribute on the window element should make the locationbar chrome go away. Removing the attribute will make the locationbar chrome come back.
Adding your location the the whitelist would probably be the easiest way to make this work:
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#4086
From your bootstrap.js code, once you get a window, try this:
if (window.XULBrowserWindow)
window.XULBrowserWindow.inContentWhitelist.push("my-url");

Remove "componentheading" from homepage - Joomla!

I'm working on a site in Joomla! and on the homepage, at the top of the article, it comes up with a h1 of the website name. The pagesource says (Note it's not the article title.)
Any idea how to get rid of it?
Thanks,
Steph
You can set this h1 tag not to display via the Parameters - System section of your Menu Item Manager screen in administrator ... this page has a nice depiction of the steps.
It's so simple
Just do the following :
Login to the Joomla Administrator Interface
Go to the Menu Manager
Select your Menu
Select your Menu Item (Home Menu)
On the right hand, Click Parameters (System)—> and in the *Show Page Title—->*Just Select No.
That's all.
This is not the desired solution, since many people, (including myself) actually need to be able to Set/Override the page title (That Appears in the Browser’s Title bar), and setting Page Title to no here will also remove the functionality to Configure the Browser title (which is important for SEO among other things).
Anyway, I have searched and not been able to find a fully correct solution via CMS or PHP Code. The closest solution which is not fully perfect, but unlikely to cause significant (if any) negative effect on your site is through Javascript (Example is JQuery).
jQuery(document).ready( function($) {
$(‘.componentheading’).empty();
});
This can also be done is JS with no JQuery. When I find a better method of doing this I’ll let you know.This should actually be done by removing output from a template file.I don’t know which one yet. When I do, I’ll post it…
When setting the page title not to show in the menu item as stated in other answers, this will not stop the text entered in the page title box being used as the browser title, it will just stop it being shown in the page.
Using javascript to remove it is not a good idea.
1. It will only work for browsers with javascript enabled
2. Search engine spiders will still see it. As the component heading for articles is 'articles' by default it will see all your pages with the same h1 tag.
Just turn it off in the menu item and enter your browser title in the text box above.

Keep Firefox sidebar links in the sidebar

I've created a bookmark in Firefox that links to a hosted web application I've written and displays the application in the sidebar using the "Load this bookmark in the sidebar" option.
When the application appears in the sidebar and I click links there, those links open in the current Firefox tab rather than staying in the sidebar. I would like the linked page to appear in the sidebar.
I'm hoping there's a simple solution, like setting the default target via a base tag, but I can't find a reference that gives me the information I need. It would be useful if the solution does not limit the application to the sidebar exclusively, and still lets the application run full-window.
I think all you need to do is link, or add target="_self"
This may be more a potential workaround than a real answer, but you could try using javascript to change document.location to the new URL. Something like:
<a href="javascript:document.location='http://whatever'>click me</a>
This would use the same 'window' object to display the new page and should load in the sidebar.

Resources