User login

JavaScript Bookmarklet to open a web site's path in a new window with a different base URL

This is useful when manually checking each page on a site to the corresponding page on a replacement site, as the final check before taking the new site live.

Starting with the basic documentation-style JavaScript, and hacked at it:




Final Version, with non-greedy matching in there between the http:// and the closing / (all those slashes escaped, which is what makes the replace look pretty crazy). Note that the target site (example.agaric etc) is hardcoded anyway so this fancy javascript regex is a little gratuitious:


Drag that code or this link - CheckOriginal - to your browser's bookmarklet bar, modify as needed (edit the bookmark) and click whenever you want to check one site's page in the other's.

UPDATE: Dump all the width, height, etc junk in order to just let the browser handle a new window or tab as it normally would.



Searched words: 
javascript replace base url javascript open path at new url javascript browser link open window with different domain javascript parse url javascript change base url path javascript remove base url greasemonkey open page with different base path selenium link check check all paths on one website on another website open site path different base url bookmarklet javascript replace function javascript replace function regular expression regular expression match to slash bookmarklet to load web path with different base bookmarklet to open web path with different base how to make a bookmarklet open in another window


Great job!

Thank you for this.
It saves me a lot of work when i want to edit a page since the production server is on another location.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.