新しいタブで簡単なリンクを開こうとしています。私はgoogleとstackoverflowで検索しようとしましたが、結果は言う、我々はブラウザで設定を変更する必要があります。 javascriptを使って同じことをする方法はありますか?ここでJavaScriptが開いているページ(IE8の新しいタブ)
はJavaScriptを必要としないサンプルスクリプト
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
function gotoNewtab(){
document.forms[0].target="_blank";
document.forms[0].method = "post";
document.forms[0].action = "http://www.google.com";
document.forms[0].submit();
}
</script>
</head>
<body>
<form name="frm">
<p> click the below link to open the page in new tab </p>
<p> <a href="##"
onclick="javaScript:return gotoNewtab();">
click here </a>
</p>
</form>
</body>
</html>
結果が現在のページを置き換えるのではなく、新しいタブを開くか新しいウィンドウを開くかはブラウザの設定に従うかどうかを尋ねることができます。 – Neil