browser compatible offset detection