Friday 7 September 2007

Opera Ctrl-click behaviour

Here's something that people may find useful!

I'm normally a Firefox fan, but I thought I'd give Opera a try. My first hurdle was that Control+Click in Firefox means "Open Link in New Tab". Ctrl+click in Opera just seems to load pages in the current tab (or current page).

So, I figured there must be a way to customise the behaviour. Initial results said "no", but then I found a page about editing Opera Settings.

In order to set up my custom Control+Left Mouse Click behaviour in Opera, I needed to:-

  • Go to Tools -> Preferences
  • Click on the Advanced Tab
  • Select Shortcuts
  • Duplicate the Opera Standard Mouse setup (and rename my duplicate as Marv Setup)
  • Edit this Mouse setup
  • Under Browser Window, hit "New"
  • In the Input field, the command to enter is "Button1 ctrl" (without the quotes)
  • For the Action, enter "Open link in new page" (without the quotes) - for Opera, "page" is the equivalent of "tab" in Firefox.
  • Click OK a few times
  • Done!
Actually, strike all that - I could have sworn that it was working, but when I re-opened Opera, it wasn't. Ah well, back to the drawing board.

Edit: Although a few people have said that you can accomplish what I want to do using the keyboard options, I've tried many permutations on Opera 9.50 in Windows XP/2003, and have been unable to get it to work. However, if you check my latest post below, I've found a solution!
Opera Ctrl Click to open in new page / tab updated

Thursday 6 September 2007

Suggestions...

Well, although I originally thought I would update this off my own back, I don't seem to have the time while searching for things to post about the results. And when I have time to write things in this blog, I've forgotten the things I've searched for.

Anyway, so if this site eventually does turn up in Google, and someone finds it and has a suggestion, please put it in the comments section!

Cheers,

Marv

JavaScript HTTP Status detection

I was using Selenium to do some SEO testing, and for political reasons the tests had to run in the Selenium IDE.
Some of the tests were for HTTP Status: certain pages should return a 301 redirect. So I was asked to find a way to extend the Selenium user-extensions.js file so that it could find the HTTP Status for a page.
I found that it's not possible to do this in JavaScript directly: there is a way to find the HTTP Status code, but unfortunately the 301 redirects are interpreted before JavaScript gets a chance to log them.
In the end, we had to implement a solution where we had our own web-service (written in C#) to read the HTTP Status for a URL, and then we just called that from the Selenium JavaScript. Because the language we were using had access to the HTTP headers from the start, it was able to pick up 301s fine (and we could also code special cases like 404s easily).

Update:
At Angelblade's request, I'm posting some of the code we used to find the HTTP status of a URL. I'm not sure how much use it will be in Java though, since a lot of the processing is handled for us in the .NET objects!
It's probably not the best code, and I'm a bit hesitant about posting it, but it could at least provide a starting point for anyone else who wants to accomplish something similar.


public Int32 GetStatus(String encodedUrl)
{

const Int32 Request_Timeout = 90000;
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(encodedUrl);
request.Timeout = Request_Timeout;
request.AllowAutoRedirect = false;
try
{
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
response.Close();
return (Int32) response.StatusCode;
}
catch (WebException webException)
{
if (webException.Status == WebExceptionStatus.ProtocolError &&
webException.Message == "The remote server returned an error: (410) Gone.")
{
return 410;
}
else
{
throw webException;
}
}

}

Can you search RSS feeds?

Official Google Reader Blog: "We found it!"

How do you search RSS feeds? Through Google Reader! Their team have just added Search to the list of tools at your disposal. You can search individual feeds, a group of feeds or all of your feeds.

At the same time, they've upped the maximum count of items from 100 to 1000 - so now I'm not just 100+ items behind ... I'm 1000+!.

If you haven't already signed up for Google Reader, I highly recommend it. It lets you manage your RSS feeds and keep track of which items you have read from whichever computer you access it from. You can also activate an offline mode to download posts for perusal when an internet connection isn't available.