User Agent Switcher

User Agent Switcher

Postby Odyseus » Fri Nov 21, 2014 12:18 am

This button is based on a script created for userChrome.js extension (Source). It allows to override the browser's current User Agent by selecting a new one from a predefined list.

Disclaimer!! The following link/s leads to an external page (GitHub). This forum is NOT responsible for any external content.

Image Install User Agent Switcher (Basic)

Image Install User Agent Switcher (Advanced)

Compatibility
Tested and working on Firefox Stable/Dev. Edition, SeaMonkey and Palemoon.
Not compatible with Nightly nor Windows Vista

Changelog - Updated June 16, 2016
  • Now there is no need to edit the button to change its preferences nor to add/edit/remove User Agents.
  • General enhancements of the kind do more with less code.


Features
  • The button can be configured to perform an action after changing the current User Agent (Do nothing, Reload current tab and Reload all tabs).
  • The button can be configured to display the current User Agent on its tooltip.
  • User Agents can be added/removed/edited with a GUI.
  • The menu appearance can be converted into a panel.
  • Advanced-Basic differences:
    • Advanced: This version supports images for each User Agent and every time the User Agent is changed, the button image will change to that of the current User Agent (can be disabled). The default image for this button can be changed by editing the variable called defaultImage, inside the Initialization tab. If the current User Agent doesn't have an image assigned or is the default User Agent, the button will use the image stored in the defaultImage variable. All items are saved inside the Initialization tab of the button.
    • Basic: This version doesn't support images and all items are saved inside a preference. The image for this button can be changed like any other Custom Button.

Images
Featuring the advanced (left) and basic (right) versions
Image Image

If any errors are found, report it ASAP on this post with as much details as possible.
  • Which platform and its version (Linux, Mac or Windows).
  • Which application and its version (Any Firefox-based browser or SeaMonkey).
  • Error/Browser console output, if any.
  • If it's easier for you to report an error with images, and if the image is too large or there are more than one, publish the links to them, do not post them using the IMG tag in the message.
  • Be willing to follow troubleshooting instructions.

All my buttons on GitHub
Last edited by Odyseus on Mon Sep 19, 2016 6:05 pm, edited 2 times in total.
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: User Agent Switcher

Postby Odyseus » Thu Jun 16, 2016 7:35 pm

Changelog - Updated June 16, 2016
  • Now there is no need to edit the button to change its preferences nor to add/edit/remove User Agents.
  • General enhancements of the kind do more with less code.
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: User Agent Switcher

Postby mcee » Sun Jul 24, 2016 3:38 am

Basic works (seems to). Advanced did not show a button in Customize. (Waterfox 47, Win8)
mcee
 
Posts: 36
Joined: Wed Oct 29, 2014 5:49 pm

Re: User Agent Switcher

Postby Odyseus » Tue Jul 26, 2016 1:39 pm

Hello, mcee.

Sorry for the delay in answering. A stupid flu almost killed me and I barely touched a computer in the last couple of weeks.

mcee wrote:Basic works (seems to).

You can test if either version works by just going into any site that shows your current user agent. Like this one.

mcee wrote:Advanced did not show a button in Customize. (Waterfox 47, Win8)

The "advanced" version uses an image common to all applications I tested the button on (chrome://branding/content/icon16.png). That image might not be present on Waterfox. You can still edit the button to change its image by going to about:addons > Custom Buttons tab. Right click on the button and select edit. Once you chanced its image, you should be able to see it in the customize dialog.

Let me know if these instructions fix your problem.
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: User Agent Switcher

Postby mcee » Tue Jul 26, 2016 9:06 pm

I have Advanced working in both Waterfox 47 and Pale Moon 27beta. I copied the code from your page rather than install and used an image from my HDD. It was probably Pale Moon where the icon was missing in Customize, but this worked.
mcee
 
Posts: 36
Joined: Wed Oct 29, 2014 5:49 pm

Re: User Agent Switcher

Postby mcee » Mon May 08, 2017 7:20 pm

EDIT MENU WINDOW
There is some sort of problem with UAS "Edit Menu" in Fx52 (specifically 52.1ESR). I get a really wide edit window, which is blank on the part I can see. When I try dragging it to get to the left side, it shows an error which is also really wide, part of it is:

XML Parsing Error: unclosed CDATA section
Location: data:application/vnd.mozilla.xul+xml;text/plain...
Line Number 409, Column 826:
[line with code here, can't get to left side of it]

(maximizing the edit window instead of dragging also shows the error)

If no one has this problem I'll try reinstalling and other things, but the button was working good and still is in WF50 and PM27. CB 0.0.5.8.9.3
mcee
 
Posts: 36
Joined: Wed Oct 29, 2014 5:49 pm

Re: User Agent Switcher

Postby Odyseus » Mon May 08, 2017 7:52 pm

Hello, mcee.

I tested it on Firefox 52, 53 (not ESR), 54 and 55 and I cannot reproduce the error. That error shows that the XML code (the one that it is used to create the edit user agents window) is not valid, and the only way that that could happen is if you edited something from the Help tab of the button that shouldn't be touched. If so, you just have to update only the code from that tab and not the entire button.

In that exact spot were the error occurs (column 826) of the original button there is CSS code. Maybe you added some CSS tweaks?
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: User Agent Switcher

Postby mcee » Tue May 09, 2017 12:17 am

Thanks for replying, and for testing. I thought your tip about the Help tab might help find the cause, but I couldn't see anything wrong. So I reinstalled and it's OK again.
mcee
 
Posts: 36
Joined: Wed Oct 29, 2014 5:49 pm


Return to Buttons made by forum users