代码之家  ›  专栏  ›  技术社区  ›  99miles

window.location.href不在Safari中工作

  •  4
  • 99miles  · 技术社区  · 14 年前

    为什么这个在野生动物中不起作用?

    <script language="javascript" type="text/javascript">
    function changeUrl(url) {
      window.location.href='http://google.com';
      return false;
    }
    </script>
    
    <form action="#" onsubmit="changeUrl(this)" />
      <input type="Submit" value="Go" />
    </form>
    
    3 回复  |  直到 8 年前
        1
  •  7
  •   Paul Kehrer    14 年前

        2
  •  0
  •   Blake Killnine    14 年前

    <script>
    function popitup(url) {
        newwindow=window.open(url,'name','height=200,width=150');
        if (window.focus) {newwindow.focus()}
        return false;
    }
    
    // -->
    </script>
    

    <a href="popupex.html" onclick="return popitup('popupex.html')">Link to popup</a>
    
        3
  •  -2
  •   IBarnes    13 年前

    if (app.Name == "Safari") {
    window.location ="your-url-here"
    }