Skip to content

Instantly share code, notes, and snippets.

@fntsrlike
Last active February 7, 2017 07:08
Show Gist options
  • Save fntsrlike/373ba751755920819189cc00408f1040 to your computer and use it in GitHub Desktop.
Save fntsrlike/373ba751755920819189cc00408f1040 to your computer and use it in GitHub Desktop.
JS 程式碼展示:在開啟本頁時,會自動開啟另一個網頁作為新分頁。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
function OpenInNewTab(url) {
var newTab = window.open(url, '_blank');
newTab.location;
}
OpenInNewTab('http://google.com.tw');
</script>
</head>
<body>
開啟本頁面會自動開啟 http://google.com.tw
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment