Skip to content

Instantly share code, notes, and snippets.

@oldj
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save oldj/d1bf6f40b7febd6498c5 to your computer and use it in GitHub Desktop.

Select an option

Save oldj/d1bf6f40b7febd6498c5 to your computer and use it in GitHub Desktop.

Revisions

  1. oldj revised this gist Jan 7, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions goto_url.js
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,10 @@
    */
    function gotoUrl(url) {
    if (!document.attachEvent) {
    //define for all browsers
    //define for none-IE browsers
    location.href = url;
    } else {
    //re-define for IE
    //define for IE
    var refer_link = document.createElement("a");
    refer_link.href = url;
    document.body.appendChild(refer_link);
  2. oldj created this gist Jan 7, 2015.
    16 changes: 16 additions & 0 deletions goto_url.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    /**
    * goto URL without losting refer
    * @see http://oldj.net/article/referrer-by-location-href-in-ie/
    */
    function gotoUrl(url) {
    if (!document.attachEvent) {
    //define for all browsers
    location.href = url;
    } else {
    //re-define for IE
    var refer_link = document.createElement("a");
    refer_link.href = url;
    document.body.appendChild(refer_link);
    refer_link.click();
    }
    }