Skip to content

Instantly share code, notes, and snippets.

@zefer
Created September 18, 2013 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zefer/6611501 to your computer and use it in GitHub Desktop.
Save zefer/6611501 to your computer and use it in GitHub Desktop.
A bit of a bodge way to test JS fallback behaviour on old browsers like IE8, using PhantomJS.
navigator.geolocation = undefined;
window.FormData = undefined;
window.getComputedStyle = undefined;
window.matchMedia = undefined;
window.FileReader = undefined;
window.Worker = undefined;
window.WebSocket = undefined;
window.requestAnimationFrame = undefined;
window.performance = undefined;
window.EventSource = undefined;
window.File = undefined;
window.FileError = undefined;
window.FileList = undefined;
window.FileReader = undefined;
window.FileReaderSync = undefined;
window.MSStream = undefined;
window.MSStreamError = undefined;
window.MSStreamReader = undefined;
window.ObjectURLOptions = undefined;
window.URL = undefined;
context 'using an old browser (IE8)', driver: :poltergeist_pretend_ie8 do
pending 'still works'
end
# Poltergeist with some JS APIs removed to pretend to sniffers that it's IE8
Capybara.register_driver :poltergeist_pretend_ie8 do |app|
Capybara::Poltergeist::Driver.new(app,
extensions: ['spec/support/ie8_spoofer.js']
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment