Workaround for Href="File://///..." in Firefox

Workaround for href= file://///... in Firefox

As it turns out, I was unaware that Firefox had this limitation/feature. I can sympathize with the feature, as it prevents a user from unwittingly accessing the local file system. Fortunately, there are useful alternatives that can provide a similar user experience while sticking to the HTTP protocol.

One alternative to accessing content via UNC paths is to publish your content using the WebDAV protocol. Some content managements systems, such as MS SharePoint, use WebDAV to provide access to documents and pages. As far as the end-user experience is concerned, it looks and feels just like accessing network files with a UNC path; however, all file interactions are performed over HTTP.

It might require a modest change in your file access philosophy, so I suggest you read about the WebDAV protocol, configuration, and permission management as it relates to your specific server technology.

Here are a few links that may be helpful if you are interested in learning more about configuring and using WebDAV on a few leading HTTP servers:

  • Apache Module mod_dav
  • IIS 7.0 WebDAV Extension
  • Configuring WebDAV Server in IIS 7, 6, 5

a href=javascript:function() in firefox not working

Give serious consideration to separating your JavaScript and your HTML such that the problem goes away. For instance, add an ID to your anchor and add an event handler through script:

<div class="frb_textcenter">
<a id="verify" target="_blank" class="frb_button frb_round frb_center frb_fullwidth" href="http://yahoo.com">
click here
</a>
</div>

Later...

<script>
function test() {
alert("test.");
var win = window.open("http://yahoo.com", '_blank');
win.focus();
}
window.onload = function () {
document.getElementById('verify').addEventListener('click', test);
};
</script>

Do note that with the example provided, you don't actually need JavaScript at all. The HTML itself will cause a new window/tab to open with Yahoo! loaded...

Workaround for file input label click (Firefox)

thank you for this q&a... helped me out.

my variation of @marten-wikstrom's solution:

if($.browser.mozilla) {
$(document).on('click', 'label', function(e) {
if(e.currentTarget === this && e.target.nodeName !== 'INPUT') {
$(this.control).click();
}
});
}

notes

  • using document.ready ($(function() {...});) is unnecessary, in either solution. jQuery.fn.live takes care of that in @marten-wikstrom's case; explicitly binding to document does in my example.
  • using jQuery.fn.on... current recommended binding technique.
  • added the !== 'INPUT' check to ensure execution does not get caught in a loop here:

    <label>
    <input type="file">
    </label>

    (since the file field click will bubble back up to the label)

  • change event.target check to event.currentTarget, allowing for initial click on the <em> in:

    <label for="field">click <em>here</em></label>
  • using the label element's control attribute for cleaner, simpler, spec-base form field association.

angular2: why window.location.href causes page refresh on Firefox but href don't

This only happens on the local angular-cli live server because by default all routes get routed to the /index.html, which is the root of your application. Angular router doesn't find your file URL and just takes you to the default route.

A nchor Link to Local File? ( a href='file:///{path}' DEAD LINK /a not working in FireFox but in IE)

Bad news: Firefox has closed a security hole:

http://www.techlifeweb.com/firefox/2006/07/how-to-open-file-links-in-firefox-15.html

It requires the user to modify a local file to allow file:// urls.

How do I make Firefox auto-refresh on file change?

Live.js

From the website:

How?
Just include Live.js and it will monitor the current page including local CSS and Javascript by sending consecutive HEAD requests to the server. Changes to CSS will be applied dynamically and HTML or Javascript changes will reload the page. Try it!

Where?
Live.js works in Firefox, Chrome, Safari, Opera and IE6+ until proven otherwise. Live.js is independent of the development framework or language you use, whether it be Ruby, Handcraft, Python, Django, NET, Java, Php, Drupal, Joomla or what-have-you.

It has the huge benefit of working with IETester, dynamically refreshing each open IE tab.

Try it out by adding the following to your <head>

<script type="text/javascript" src="http://livejs.com/live.js"></script>

XSLT stylesheet isn't applied to XML in Firefox. How to fix it?

This seems to be the usual problem that newer versions of Firefox apply a stricter policy regarding the source of the XML-XSLT combination. If the XML and XSLT are local files, Firefox will block/ignore the reference to the XSLT.

The solution is changing one setting in about:config: Set

privacy.file_unique_origin

to false. This is the preferred modification, as suggested by @evilpie.

This should make your XML display as desired. It is discussed here: Firefox 68: local files now treated as cross-origin (1558299).

Mailto links do nothing in Chrome but work in Firefox?

This is browser settings specific, i.e. it will behave differently depending on the user's browser settings. The user can change how mailto: links behave in chrome by visiting chrome://settings/handlers, or Chrome Settings->Content Settings->Manage Handlers...

If "email" is not listed on that page, then see this answer regarding how to proceed.



Related Topics



Leave a reply



Submit