Prevent JavaScript Redirect in Firefox
Hero Add-on of the day
I recently set up a simple web page using the "click-and-play" CMS Jimdo recently, but realized today that the URL I chose for my site could have been better. I decided to set up another page with a new URL and redirect to it from the first site.
As a first attempt, I tried a simple Javascript approach, using a random test URL which pointed to nothing:
<script type="text/javascript">
This worked. However, Jimdo is a quite WYSIWYG-oriented CMS, and needs to show the web page in order to edit it. Trying to edit the original page now sent me directly to the test URL instead! Disabling Javascript did not help either, since it broke the CMS interface. Nice catch-22. I was stuck with a broken page.
document.location = "http://example.com";
</script>
The solution: RequestPolicy! This Firefox plugin warns you when a site attempts a Javascript redirect and lets you prevent it from happening, without breaking any other Javascript code. After installation, I just opened the page, the redirect was prevented, and I could edit the page again - like correcting the URL.
That said, a Javascript redirect is less than ideal. If you can, use a 301 redirect (Google it) whenever possible.
3 Comments
Subscribe to new comments by RSS