# Dope Search

**URL:** <https://boards.straightdope.com/t/dope-search/505613>\
**Category:** About This Message Board\
**Created:** [August 7, 2009, 8:15am UTC](https://boards.straightdope.com/t/dope-search/505613 "2009-08-07T08:15:48Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![spinky](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@spinky](https://boards.straightdope.com/u/spinky)\
**Post date:** [August 8, 2009, 2:00am UTC](https://boards.straightdope.com/t/dope-search/505613/21 "2009-08-08T02:00:00Z")

</div>

Works for me. I stuck a copy here: [http://splitter.mufux.com/sdmb/](http://splitter.mufux.com/sdmb/)  
(I tweaked the frameset sizes a little)

---

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [August 8, 2009, 2:30am UTC](https://boards.straightdope.com/t/dope-search/505613/22 "2009-08-08T02:30:29Z")

</div>

> [@ntucker](#):
>
> Works for me. I stuck a copy here: [http://splitter.mufux.com/sdmb/](http://splitter.mufux.com/sdmb/)  
> (I tweaked the frameset sizes a little)

I still get the exact same errors. And I’m not doing InPrivate Browsing, or anything like that.

---

<div class="post-metadata">

**Author:** ![IAmNotSpartacus](https://avatars.discourse-cdn.com/v4/letter/i/cc9497/32.png) [@IAmNotSpartacus](https://boards.straightdope.com/u/IAmNotSpartacus)\
**Post date:** [August 8, 2009, 4:40am UTC](https://boards.straightdope.com/t/dope-search/505613/23 "2009-08-08T04:40:22Z")

</div>

> [@Liberal](#):
>
> I still get the exact same errors. And I’m not doing InPrivate Browsing, or anything like that.

Stop using Internet Explorer 😃

---

<div class="post-metadata">

**Author:** ![elmwood](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/elmwood/32/3060_2.png) [@elmwood](https://boards.straightdope.com/u/elmwood)\
**Post date:** [August 8, 2009, 5:10am UTC](https://boards.straightdope.com/t/dope-search/505613/24 "2009-08-08T05:10:49Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [August 8, 2009, 12:23pm UTC](https://boards.straightdope.com/t/dope-search/505613/25 "2009-08-08T12:23:56Z")

</div>

> [@IAmNotSpartacus](#):
>
> Stop using Internet Explorer 😃

Sorry. No can do. Work requires it. An alternative would be to correct the errors.

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [August 8, 2009, 6:17pm UTC](https://boards.straightdope.com/t/dope-search/505613/26 "2009-08-08T18:17:28Z")

</div>

> [@alterego](#):
>
> Just save the files to your local hard disk and then enter the path to index.html on your local disk into your browser.

That’s what I figured and what I tried. No luck in Chrome on Vista

> [@ntucker](#):
>
> Works for me. I stuck a copy here: [http://splitter.mufux.com/sdmb/](http://splitter.mufux.com/sdmb/)  
> (I tweaked the frameset sizes a little)

Neither did this one.

When you hit Search (or Enter) it just clears the form and nothing happens.

---

<div class="post-metadata">

**Author:** ![alterego](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@alterego](https://boards.straightdope.com/u/alterego)\
**Post date:** [August 8, 2009, 8:36pm UTC](https://boards.straightdope.com/t/dope-search/505613/27 "2009-08-08T20:36:52Z")

</div>

To summarize, it works in Safari and Firefox, but not Internet Explorer, Opera, Google Chrome, or Konqueror. If anyone wants to port it to those browsers feel free!

---

<div class="post-metadata">

**Author:** ![alterego](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@alterego](https://boards.straightdope.com/u/alterego)\
**Post date:** [August 9, 2009, 8:52am UTC](https://boards.straightdope.com/t/dope-search/505613/28 "2009-08-09T08:52:13Z")

</div>

A few more updates:

- Now fully contained in a single file (using iframe instead of frameset)
- Searching doesn’t reset the form

Still only tested in Firefox/Safari, but maybe it works in others too now…

**index.html**

```auto

<html>
  <script>
var forum, title, query;
function UpdateQuery(){query = document.getElementsByName("query")[0].value;}
function UpdateTitle(){title = document.getElementsByName("title")[0].value;}
function SearchForum(){forum = document.getElementById("forum").options[document.getElementById("forum").selectedIndex].value;}
function SearchRecency(){recency = document.getElementById("recency").options[document.getElementById("recency").selectedIndex].value;}
function SearchSort(){sorting = document.getElementById("sorting").options[document.getElementById("sorting").selectedIndex].value;}
function resizeFrame(f){f.style.height = f.contentWindow.document.body.scrollHeight + "px";}
function DopeSearch() {
  var url = "http://www.google.com/search?q=site:boards.straightdope.com";
  var tbs = "&num=100&filter=0&tbs=frm:1,sts:1";
  var username = document.search.username.value;
  var from = document.search.from.value;
  var to = document.search.to.value;
  if (query) url += ' ' + query;
  if (title) url += ' intitle:"' + title + '"';
  if (username) url += ' %2B"Find all posts by ' + username + '"';
  if (forum) url += ' %2B"Board > Main > ' + forum + '"';
  if (recency) tbs += ',' + recency;
  if (from && to) tbs += ',cdr:1,cd_min:' + from + ',cd_max:' + to;
  if (sorting) tbs += ',' + sorting;
  document.getElementById("google").src = url + tbs;
}
  </script>
  <body onload="resizeFrame(document.getElementById('google'))">
    <center>
      <h3>Dope Search</h3>
      <form onsubmit="DopeSearch();return false" name="search">
        <select id="forum" onchange="SearchForum()">
          <option value="All forums" selected="selected">All forums</option>
          <option value="About This Message Board">ATMB</option>
          <option value="Comments on Cecil's Columns">CCC</option>
          <option value="General Questions">GQ</option>
          <option value="Great Debates">GD</option>
          <option value="Cafe Society">CS</option>
          <option value="The Game Room">TGR</option>
          <option value="In My Humble Opinion">IMHO</option>
          <option value="Mundane Pointless Stuff I Must Share">MPSIMS</option>
          <option value="The BBQ Pit">The Pit</option>
        </select>
        User: <input type="text" name="username" size="13%">
        <select id="recency" onchange="SearchRecency()">
          <option value="All times" selected="selected">All time</option>
          <option value="qdr:y">Last year</option>
          <option value="qdr:m">Last month</option>
          <option value="qdr:w">Last week</option>
          <option value="qdr:d">Last day</option>
        </select>
        From: <input type="text" name="from" size="7%">
        To: <input type="text" name="to" size="7%"> (M/D/YYYY) <br/><br/>
        Title: <input type="text" size="20%" name="title" onchange="UpdateTitle()">
        Query: <input type="text" size="30%" name="query" onchange="UpdateQuery()">
        <select id="sorting" onchange="SearchSort()">
          <option value="sbd:0" selected="selected">Sort by relevance</option>
          <option value="sbd:1">Sort by date</option>
        </select>
        <input type="submit" value="Search">
      </form>
    </center>
    <iframe id="google" frameborder="0" width="100%" height="75%" src="http://www.google.com/search?q=site:boards.straightdope.com&tbs=frm:1,sts:1,qdr:d&num=100"></iframe>
  </body>
</html>

```

---

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [August 9, 2009, 9:12am UTC](https://boards.straightdope.com/t/dope-search/505613/29 "2009-08-09T09:12:18Z")

</div>

Bracket error is gone, but access is still denied.

---

<div class="post-metadata">

**Author:** ![spinky](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@spinky](https://boards.straightdope.com/u/spinky)\
**Post date:** [August 9, 2009, 10:00am UTC](https://boards.straightdope.com/t/dope-search/505613/30 "2009-08-09T10:00:49Z")

</div>

**Alterego** , I found an IE-only bug: you didn’t have global-scope definitions for “recency” and “sorting”, so DopeSearch() was throwing exceptions. I stuck a fixed version [here](http://splitter.mufux.com/sdmb/). I don’t have IE8 though, so I don’t know if that fixes **Liberal’s** problem.

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [August 9, 2009, 11:59am UTC](https://boards.straightdope.com/t/dope-search/505613/31 "2009-08-09T11:59:03Z")

</div>

Works on Chrome!

---

<div class="post-metadata">

**Author:** ![choie](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/choie/32/7829_2.png) [@choie](https://boards.straightdope.com/u/choie)\
**Post date:** [August 9, 2009, 5:31pm UTC](https://boards.straightdope.com/t/dope-search/505613/32 "2009-08-09T17:31:04Z")

</div>

Thanks very much, **alterego**!

The trouble in IE is due to cross-frame scripting – the iframe (or frameset, in the earlier version) is trying to access a script on a different domain from the original server, or local application if you’re using it on your own machine. This is a security no-no and IE is stamping its feet in protest. Not solveable, I don’t think.

So the solution for IE users is to go the manual route, aka going to Google and typing:

_site:boards.straightdope.com “Board \> Main \> (name of subforum)” + (topic you’re searching for)_

So if you’re doing a search for “hospital” and “attorney” in General Questions, you’d type:

_site:boards.straightdope.com “Board \> Main \> General Questions” + attorney hospital_

… Or just wait until you get home and use FF or Chrome or any other browser. Not an elegant solution, as is **alterego** ’s brilliant and very generous scripting effort, but nothing’s perfect.

Here’s an HTML-cleaned up version of the file, which is lacking a few niceties from an HTML standpoint (e.g. a DOCTYPE, HEAD tags for the script, a script type declaration, and properly escaped “&” characters in the search parameters – & instead of &, in other words):

```auto

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
var forum, title, query;
function UpdateQuery(){query = document.getElementsByName("query")[0].value;}
function UpdateTitle(){title = document.getElementsByName("title")[0].value;}
function SearchForum(){forum = document.getElementById("forum").options[document.getElementById("forum").selectedIndex].value;}
function SearchRecency(){recency = document.getElementById("recency").options[document.getElementById("recency").selectedIndex].value;}
function SearchSort(){sorting = document.getElementById("sorting").options[document.getElementById("sorting").selectedIndex].value;}
function resizeFrame(f){f.style.height = f.contentWindow.document.body.scrollHeight + "px";}
function DopeSearch() {
  var url = "http://www.google.com/search?q=site:boards.straightdope.com";
  var tbs = "&num=100&filter=0&tbs=frm:1,sts:1";
  var username = document.search.username.value;
  var from = document.search.from.value;
  var to = document.search.to.value;
  if (query) url += ' ' + query;
  if (title) url += ' intitle:"' + title + '"';
  if (username) url += ' %2B"Find all posts by ' + username + '"';
  if (forum) url += ' %2B"Board > Main > ' + forum + '"';
  if (recency) tbs += ',' + recency;
  if (from && to) tbs += ',cdr:1,cd_min:' + from + ',cd_max:' + to;
  if (sorting) tbs += ',' + sorting;
  document.getElementById("google").src = url + tbs;
}
</script>
<title>Dope Search by Alterego</title>
</head>
<body onload="resizeFrame(document.getElementById('google'))">
<center>
<h3>Dope Search</h3>
<form onsubmit="DopeSearch();return false" name="search" id=
"search"><select id="forum" onchange="SearchForum()">
<option value="All forums" selected="selected">All forums</option>
<option value="About This Message Board">ATMB</option>
<option value="Comments on Cecil's Columns">CCC</option>
<option value="General Questions">GQ</option>
<option value="Great Debates">GD</option>
<option value="Cafe Society">CS</option>
<option value="The Game Room">TGR</option>
<option value="In My Humble Opinion">IMHO</option>
<option value="Mundane Pointless Stuff I Must Share">
MPSIMS</option>
<option value="The BBQ Pit">The Pit</option>
</select> User: <input type="text" name="username" size="13%">
<select id="recency" onchange="SearchRecency()">
<option value="All times" selected="selected">All time</option>
<option value="qdr:y">Last year</option>
<option value="qdr:m">Last month</option>
<option value="qdr:w">Last week</option>
<option value="qdr:d">Last day</option>
</select> From: <input type="text" name="from" size="7%"> To:
<input type="text" name="to" size="7%"> (M/D/YYYY)<br>
<br>
Title: <input type="text" size="20%" name="title" onchange=
"UpdateTitle()"> Query: <input type="text" size="30%" name="query"
onchange="UpdateQuery()"> <select id="sorting" onchange=
"SearchSort()">
<option value="sbd:0" selected="selected">Sort by
relevance</option>
<option value="sbd:1">Sort by date</option>
</select> <input type="submit" value="Search"></form>
</center>
<iframe id="google" frameborder="0" width="100%" height="75%" src=
"http://www.google.com/search?q=site:boards.straightdope.com&tbs=frm:1,sts:1,qdr:d&num=100"
name="google"></iframe>
</body>
</html>

```

Thanks again, **alterego**.

---

<div class="post-metadata">

**Author:** ![choie](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/choie/32/7829_2.png) [@choie](https://boards.straightdope.com/u/choie)\
**Post date:** [August 9, 2009, 5:40pm UTC](https://boards.straightdope.com/t/dope-search/505613/33 "2009-08-09T17:40:54Z")

</div>

Or, doy, use [this](http://boards.straightdope.com/sdmb/showthread.php?t=518829), which the inestimable **alterego** created as the ultimate guide to searching. Which I only just saw now. Because I am an idiot.

---

<div class="post-metadata">

**Author:** ![alterego](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@alterego](https://boards.straightdope.com/u/alterego)\
**Post date:** [August 9, 2009, 8:13pm UTC](https://boards.straightdope.com/t/dope-search/505613/34 "2009-08-09T20:13:00Z")

</div>

Yikes, after spending way too much time trying to get this to work in IE, I’m sorry to say to IE users that you’ll just have to use Firefox, Safari, Chrome, etc… IE has really moved the intelligence of their browser down to the lowest common denominator, which is pretty durn low…

---

<div class="post-metadata">

**Author:** ![Polerius](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Polerius](https://boards.straightdope.com/u/Polerius)\
**Post date:** [August 9, 2009, 10:31pm UTC](https://boards.straightdope.com/t/dope-search/505613/35 "2009-08-09T22:31:10Z")

</div>

I took **choie** ’s code and put it into a bookmark which has a javascript call instead of a url.

The result: I have a bookmark on my browser that I can click to search the SDMB, without having to save the code in a file on my hard disk.

Tested and works in Firefox and Chrome.  
Tested and does not work in IE.

To use, you need to create a bookmark, and then under Properties -\> Location, you need to insert the following code.

```auto

javascript:newWinLeftPos=self.screen.width-810;newWinOptions="left="+newWinLeftPos+",height=180,width=800,toolbar=no,menubar=no,resizable=yes";OpenWindow=window.open("","plotdata",newWinOptions);OpenWindow.document.writeln("<!DOCTYPE%20html%20PUBLIC%20\"-//W3C//DTD%20HTML%204.01%20Transitional//EN\">%20<html>%20<head>%20<script%20type=\"text/javascript\">%20var%20forum,%20title,%20query;%20function%20UpdateQuery(){query%20=%20document.getElementsByName(\"query\")[0].value;}%20function%20UpdateTitle(){title%20=%20document.getElementsByName(\"title\")[0].value;}%20function%20SearchForum(){forum%20=%20document.getElementById(\"forum\").options[document.getElementById(\"forum\").selectedIndex].value;}%20function%20SearchRecency(){recency%20=%20document.getElementById(\"recency\").options[document.getElementById(\"recency\").selectedIndex].value;}%20function%20SearchSort(){sorting%20=%20document.getElementById(\"sorting\").options[document.getElementById(\"sorting\").selectedIndex].value;}%20function%20resizeFrame(f){f.style.height%20=%20f.contentWindow.document.body.scrollHeight%20+%20\"px\";}%20function%20DopeSearch()%20{%20var%20url%20=%20\"http://www.google.com/search?q=site:boards.straightdope.com\";%20var%20tbs%20=%20\"&num=100&filter=0&tbs=frm:1,sts:1\";%20var%20username%20=%20document.search.username.value;%20var%20from%20=%20document.search.from.value;%20var%20to%20=%20document.search.to.value;%20if%20(query)%20url%20+=%20'%20'%20+%20query;%20if%20(title)%20url%20+=%20'%20intitle:\"'%20+%20title%20+%20'\"';%20if%20(username)%20url%20+=%20'%20%2B\"Find%20all%20posts%20by%20'%20+%20username%20+%20'\"';%20if%20(forum)%20url%20+=%20'%20%2B\"Board%20>%20Main%20>%20'%20+%20forum%20+%20'\"';%20if%20(recency)%20tbs%20+=%20','%20+%20recency;%20if%20(from%20&&%20to)%20tbs%20+=%20',cdr:1,cd_min:'%20+%20from%20+%20',cd_max:'%20+%20to;%20if%20(sorting)%20tbs%20+=%20','%20+%20sorting;%20window.opener.location.href%20=%20url%20+%20tbs;%20}%20</script>%20<title>Dope%20Search%20by%20Alterego</title>%20</head>%20<body>%20<center>%20<h3>Dope%20Search</h3>%20<form%20onsubmit=\"DopeSearch();return%20false\"%20name=\"search\"%20id=%20\"search\"><select%20id=\"forum\"%20onchange=\"SearchForum()\">%20<option%20value=\"All%20forums\"%20selected=\"selected\">All%20forums</option>%20<option%20value=\"About%20This%20Message%20Board\">ATMB</option>%20<option%20value=\"Comments%20on%20Cecil's%20Columns\">CCC</option>%20<option%20value=\"General%20Questions\">GQ</option>%20<option%20value=\"Great%20Debates\">GD</option>%20<option%20value=\"Cafe%20Society\">CS</option>%20<option%20value=\"The%20Game%20Room\">TGR</option>%20<option%20value=\"In%20My%20Humble%20Opinion\">IMHO</option>%20<option%20value=\"Mundane%20Pointless%20Stuff%20I%20Must%20Share\">%20MPSIMS</option>%20<option%20value=\"The%20BBQ%20Pit\">The%20Pit</option>%20</select>%20User:%20<input%20type=\"text\"%20name=\"username\"%20size=\"13%\">%20<select%20id=\"recency\"%20onchange=\"SearchRecency()\">%20<option%20value=\"All%20times\"%20selected=\"selected\">All%20time</option>%20<option%20value=\"qdr:y\">Last%20year</option>%20<option%20value=\"qdr:m\">Last%20month</option>%20<option%20value=\"qdr:w\">Last%20week</option>%20<option%20value=\"qdr:d\">Last%20day</option>%20</select>%20From:%20<input%20type=\"text\"%20name=\"from\"%20size=\"7%\">%20To:%20<input%20type=\"text\"%20name=\"to\"%20size=\"7%\">%20(M/D/YYYY)<br>%20<br>%20Title:%20<input%20type=\"text\"%20size=\"20%\"%20name=\"title\"%20onchange=%20\"UpdateTitle()\">%20Query:%20<input%20type=\"text\"%20size=\"30%\"%20name=\"query\"%20onchange=\"UpdateQuery()\">%20<select%20id=\"sorting\"%20onchange=%20\"SearchSort()\">%20<option%20value=\"sbd:0\"%20selected=\"selected\">Sort%20by%20relevance</option>%20<option%20value=\"sbd:1\">Sort%20by%20date</option>%20</select>%20<input%20type=\"submit\"%20value=\"Search\"></form>%20</center></body>%20</html>");OpenWindow.document.close();

```

---

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [August 9, 2009, 10:40pm UTC](https://boards.straightdope.com/t/dope-search/505613/36 "2009-08-09T22:40:35Z")

</div>

Gentle Programmers

I don’t understand why people are knocking IE8 for disallowing a “security no-no”. Admittedly, it is inconvenient for this particular purpose. But I like my browser balking at security breaches, the same as I like my bank asking me my mother’s maiden name and the street I grew up on when I call with questions about my accounts. It’s not a hassle. It’s peace of mind. To me, anyway.

---

<div class="post-metadata">

**Author:** ![alterego](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@alterego](https://boards.straightdope.com/u/alterego)\
**Post date:** [August 9, 2009, 10:42pm UTC](https://boards.straightdope.com/t/dope-search/505613/37 "2009-08-09T22:42:41Z")

</div>

> [@Polerius](#):
>
> I took **choie** ’s code and put it into a bookmark which has a javascript call instead of a url.
> 
> The result: I have a bookmark on my browser that I can click to search the SDMB, without having to save the code in a file on my hard disk.
> 
> Tested and works in Firefox and Chrome.  
> Tested and does not work in IE.
> 
> To use, you need to create a bookmark, and then under Properties -\> Location, you need to insert the following code.
> 
> ```auto
> 
> javascript:newWinLeftPos=self.screen.width-810;newWinOptions="left="+newWinLeftPos+",height=180,width=800,toolbar=no,menubar=no,resizable=yes";OpenWindow=window.open("","plotdata",newWinOptions);OpenWindow.document.writeln("<!DOCTYPE%20html%20PUBLIC%20\"-//W3C//DTD%20HTML%204.01%20Transitional//EN\">%20<html>%20<head>%20<script%20type=\"text/javascript\">%20var%20forum,%20title,%20query;%20function%20UpdateQuery(){query%20=%20document.getElementsByName(\"query\")[0].value;}%20function%20UpdateTitle(){title%20=%20document.getElementsByName(\"title\")[0].value;}%20function%20SearchForum(){forum%20=%20document.getElementById(\"forum\").options[document.getElementById(\"forum\").selectedIndex].value;}%20function%20SearchRecency(){recency%20=%20document.getElementById(\"recency\").options[document.getElementById(\"recency\").selectedIndex].value;}%20function%20SearchSort(){sorting%20=%20document.getElementById(\"sorting\").options[document.getElementById(\"sorting\").selectedIndex].value;}%20function%20resizeFrame(f){f.style.height%20=%20f.contentWindow.document.body.scrollHeight%20+%20\"px\";}%20function%20DopeSearch()%20{%20var%20url%20=%20\"http://www.google.com/search?q=site:boards.straightdope.com\";%20var%20tbs%20=%20\"&num=100&filter=0&tbs=frm:1,sts:1\";%20var%20username%20=%20document.search.username.value;%20var%20from%20=%20document.search.from.value;%20var%20to%20=%20document.search.to.value;%20if%20(query)%20url%20+=%20'%20'%20+%20query;%20if%20(title)%20url%20+=%20'%20intitle:\"'%20+%20title%20+%20'\"';%20if%20(username)%20url%20+=%20'%20%2B\"Find%20all%20posts%20by%20'%20+%20username%20+%20'\"';%20if%20(forum)%20url%20+=%20'%20%2B\"Board%20>%20Main%20>%20'%20+%20forum%20+%20'\"';%20if%20(recency)%20tbs%20+=%20','%20+%20recency;%20if%20(from%20&&%20to)%20tbs%20+=%20',cdr:1,cd_min:'%20+%20from%20+%20',cd_max:'%20+%20to;%20if%20(sorting)%20tbs%20+=%20','%20+%20sorting;%20window.opener.location.href%20=%20url%20+%20tbs;%20}%20</script>%20<title>Dope%20Search%20by%20Alterego</title>%20</head>%20<body>%20<center>%20<h3>Dope%20Search</h3>%20<form%20onsubmit=\"DopeSearch();return%20false\"%20name=\"search\"%20id=%20\"search\"><select%20id=\"forum\"%20onchange=\"SearchForum()\">%20<option%20value=\"All%20forums\"%20selected=\"selected\">All%20forums</option>%20<option%20value=\"About%20This%20Message%20Board\">ATMB</option>%20<option%20value=\"Comments%20on%20Cecil's%20Columns\">CCC</option>%20<option%20value=\"General%20Questions\">GQ</option>%20<option%20value=\"Great%20Debates\">GD</option>%20<option%20value=\"Cafe%20Society\">CS</option>%20<option%20value=\"The%20Game%20Room\">TGR</option>%20<option%20value=\"In%20My%20Humble%20Opinion\">IMHO</option>%20<option%20value=\"Mundane%20Pointless%20Stuff%20I%20Must%20Share\">%20MPSIMS</option>%20<option%20value=\"The%20BBQ%20Pit\">The%20Pit</option>%20</select>%20User:%20<input%20type=\"text\"%20name=\"username\"%20size=\"13%\">%20<select%20id=\"recency\"%20onchange=\"SearchRecency()\">%20<option%20value=\"All%20times\"%20selected=\"selected\">All%20time</option>%20<option%20value=\"qdr:y\">Last%20year</option>%20<option%20value=\"qdr:m\">Last%20month</option>%20<option%20value=\"qdr:w\">Last%20week</option>%20<option%20value=\"qdr:d\">Last%20day</option>%20</select>%20From:%20<input%20type=\"text\"%20name=\"from\"%20size=\"7%\">%20To:%20<input%20type=\"text\"%20name=\"to\"%20size=\"7%\">%20(M/D/YYYY)<br>%20<br>%20Title:%20<input%20type=\"text\"%20size=\"20%\"%20name=\"title\"%20onchange=%20\"UpdateTitle()\">%20Query:%20<input%20type=\"text\"%20size=\"30%\"%20name=\"query\"%20onchange=\"UpdateQuery()\">%20<select%20id=\"sorting\"%20onchange=%20\"SearchSort()\">%20<option%20value=\"sbd:0\"%20selected=\"selected\">Sort%20by%20relevance</option>%20<option%20value=\"sbd:1\">Sort%20by%20date</option>%20</select>%20<input%20type=\"submit\"%20value=\"Search\"></form>%20</center></body>%20</html>");OpenWindow.document.close();
> 
> ```

Nice! I will publish future versions in both forms.

---

<div class="post-metadata">

**Author:** ![alterego](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@alterego](https://boards.straightdope.com/u/alterego)\
**Post date:** [August 9, 2009, 10:46pm UTC](https://boards.straightdope.com/t/dope-search/505613/38 "2009-08-09T22:46:36Z")

</div>

> [@Liberal](#):
>
> Gentle Programmers
> 
> I don’t understand why people are knocking IE8 for disallowing a “security no-no”.

Going by votes four of the top five browsers by market share have voted that it is not a security no no. It’s really just a matter of how far you let the programmer go down the rabbit hole, so to speak. Microsoft doesn’t allow you to change the source of the iframe, whereas the other browsers do allow you to change the source but don’t allow you to programmatically access the DOM of the iframe’d page. For security purposes only the latter is necessary. Also note that Microsoft also has to take extra precautions to protect themselves against all of the exploites on their other browser products, such as ActiveX.

---

<div class="post-metadata">

**Author:** ![choie](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/choie/32/7829_2.png) [@choie](https://boards.straightdope.com/u/choie)\
**Post date:** [August 10, 2009, 12:32am UTC](https://boards.straightdope.com/t/dope-search/505613/39 "2009-08-10T00:32:40Z")

</div>

Hey **Liberal**. I’m definitely not dissing IE for that particular issue.

I do think it would be best if it were an option – that is, if IE asked us, “are you sure you want to allow this link to run a script from another domain?” and let _us_ decide whether to continue – rather than refusing to run altogether. Still, that’s their call, and probably an understandable one considering how vulnerable IE can be, and also that some IE users are perhaps not as techie-oriented as FF/Chromites (simply because IE has been the default browser on so many new users’ machines whereas I believe the other browsers must be specifically installed).

I’m not a browser purist. I like different browsers for different purposes. I’m using IE7 right now, matter o’ fact.

**Polerius** , glad the code was useful. I only made a few tweaks to clean things up, html-wise. I’m a designer not a programmer by any stretch. I love your bookmark idea!

---

<div class="post-metadata">

**Author:** ![alterego](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@alterego](https://boards.straightdope.com/u/alterego)\
**Post date:** [August 10, 2009, 1:43am UTC](https://boards.straightdope.com/t/dope-search/505613/40 "2009-08-10T01:43:50Z")

</div>

Here is an intermediate version that only works in Firefox, with ideas and fixes from Polerius and choie. It also gives you a permalink to the search (which has an inconsequential bug…). I’m planning to have it support the SDMB search engine as well but got side tracked.

**Bookmarklet** : Create a bookmark and put this code where you would normally put a url. In firefox, triple click on the code to highlight it, and then drag the code to your bookmark toolbar to automatically create a bookmark. (then name it)

```auto

javascript:document.innerHTML%20=%20'%20<!DOCTYPE%20html%20PUBLIC%20"-//W3C//DTD%20HTML%204.01%20Transitional//EN">%20<html>%20%20%20<head>%20%20%20%20%20%20<script%20type="text/javascript">%20var%20forum,%20title,%20query;%20function%20UpdateQuery(){query%20=%20document.getElementsByName("query")[0].value;}%20function%20UpdateTitle(){title%20=%20document.getElementsByName("title")[0].value;}%20function%20SearchForum(){forum%20=%20document.getElementById("forum").options[document.getElementById("forum").selectedIndex].value;}%20function%20SearchRecency(){recency%20=%20document.getElementById("recency").options[document.getElementById("recency").selectedIndex].value;}%20function%20SearchSort(){sorting%20=%20document.getElementById("sorting").options[document.getElementById("sorting").selectedIndex].value;}%20function%20DopeSearch()%20{%20%20%20var%20url%20=%20"http://www.google.com/search?q=site:boards.straightdope.com";%20%20%20var%20tbs%20=%20"&num=100&filter=0&tbs=frm:1,sts:1";%20%20%20var%20username%20=%20document.search.username.value;%20%20%20var%20from%20=%20document.search.from.value;%20%20%20var%20to%20=%20document.search.to.value;%20%20%20if%20(query)%20url%20+=%20\'%20\'%20+%20query;%20%20%20if%20(title)%20url%20+=%20\'%20intitle:"\'%20+%20title%20+%20\'"\';%20%20%20if%20(username)%20url%20+=%20\'%20%2B"Find%20all%20posts%20by%20\'%20+%20username%20+%20\'"\';%20%20%20if%20(forum)%20url%20+=%20\'%20%2B"Board%20>%20Main%20>%20\'%20+%20forum%20+%20\'"\';%20%20%20if%20(recency)%20tbs%20+=%20\',\'%20+%20recency;%20%20%20if%20(from%20&&%20to)%20tbs%20+=%20\',cdr:1,cd_min:\'%20+%20from%20+%20\',cd_max:\'%20+%20to;%20%20%20if%20(sorting)%20tbs%20+=%20\',\'%20+%20sorting;%20%20%20url%20=%20url%20+%20tbs;%20%20%20google%20=%20document.getElementById("google");%20%20%20if%20(google)%20google.parentNode.removeChild(google);%20%20%20var%20tmp%20=%20document.createElement("iframe");%20%20%20tmp.setAttribute("id",%20"google");%20%20%20tmp.style.border%20=%20"0px";%20%20%20tmp.style.width%20=%20"100%";%20%20%20tmp.style.height%20=%20"75%";%20%20%20tmp.src%20=%20url;%20%20%20google%20=%20document.body.appendChild(tmp);%20%20%20document.getElementById("bookmark").href%20=%20url;%20}%20%20%20%20%20</script>%20%20%20%20%20<title>Dope%20Search%20by%20alterego,%20choie,%20and%20Polerius</title>%20%20%20</head>%20%20%20<body>%20%20%20%20%20<center>%20%20%20%20%20%20%20%20<h3>Dope%20Search</h3>%20%20%20%20%20%20%20<form%20onsubmit="DopeSearch();return%20false"%20name="search">%20%20%20%20%20%20%20%20%20<select%20id="forum"%20onchange="SearchForum()">%20%20%20%20%20%20%20%20%20%20%20<option%20value="All%20forums"%20selected="selected">All%20forums</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="About%20This%20Message%20Board">ATMB</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="Comments%20on%20Cecil\'s%20Columns">CCC</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="General%20Questions">GQ</option>%20%20%20%20%20%20%20%20%20%20%20%20<option%20value="Great%20Debates">GD</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="Cafe%20Society">CS</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="The%20Game%20Room">TGR</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="In%20My%20Humble%20Opinion">IMHO</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="Mundane%20Pointless%20Stuff%20I%20Must%20Share">MPSIMS</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="The%20BBQ%20Pit">The%20Pit</option>%20%20%20%20%20%20%20%20%20%20</select>%20%20%20%20%20%20%20%20%20User:%20<input%20type="text"%20name="username"%20size="13%">%20%20%20%20%20%20%20%20%20<select%20id="recency"%20onchange="SearchRecency()">%20%20%20%20%20%20%20%20%20%20%20<option%20value="All%20times"%20selected="selected">All%20time</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="qdr:y">Last%20year</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="qdr:m">Last%20month</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="qdr:w">Last%20week</option>%20%20%20%20%20%20%20%20%20%20%20%20<option%20value="qdr:d">Last%20day</option>%20%20%20%20%20%20%20%20%20</select>%20%20%20%20%20%20%20%20%20From:%20<input%20type="text"%20name="from"%20size="7%">%20%20%20%20%20%20%20%20%20To:%20<input%20type="text"%20name="to"%20size="7%">%20(M/D/YYYY)%20<br/><br/>%20%20%20%20%20%20%20%20%20Title:%20<input%20type="text"%20size="20%"%20name="title"%20onchange="UpdateTitle()">%20%20%20%20%20%20%20%20%20Query:%20<input%20type="text"%20size="30%"%20name="query"%20onchange="UpdateQuery()">%20%20%20%20%20%20%20%20%20%20<select%20id="sorting"%20onchange="SearchSort()">%20%20%20%20%20%20%20%20%20%20%20<option%20value="sbd:0"%20selected="selected">Sort%20by%20relevance</option>%20%20%20%20%20%20%20%20%20%20%20<option%20value="sbd:1">Sort%20by%20date</option>%20%20%20%20%20%20%20%20%20</select>%20%20%20%20%20%20%20%20%20<input%20type="submit"%20value="Search">%20%20%20%20%20%20%20%20%20<a%20id="bookmark"%20href="http://www.google.com/search?q=site:boards.straightdope.com&tbs=frm:1,sts:1,qdr:d&num=100">Link</a>%20%20%20%20%20%20%20</form>%20%20%20%20%20%20</center>%20%20%20%20%20<iframe%20id="google"%20frameborder="0"%20width="100%"%20height="75%"%20src="http://www.google.com/search?q=site:boards.straightdope.com&tbs=frm:1,sts:1,qdr:d&num=100"></iframe>%20%20%20</body>%20</html>';

```

**Full version** (also a bookmarklet, but just remove the first line to have the regular web page back)

```auto

javascript:document.innerHTML = '
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
     <script type="text/javascript">
var forum, title, query;
function UpdateQuery(){query = document.getElementsByName("query")[0].value;}
function UpdateTitle(){title = document.getElementsByName("title")[0].value;}
function SearchForum(){forum = document.getElementById("forum").options[document.getElementById("forum").selectedIndex].value;}
function SearchRecency(){recency = document.getElementById("recency").options[document.getElementById("recency").selectedIndex].value;}
function SearchSort(){sorting = document.getElementById("sorting").options[document.getElementById("sorting").selectedIndex].value;}
function DopeSearch() {
  var url = "http://www.google.com/search?q=site:boards.straightdope.com";
  var tbs = "&num=100&filter=0&tbs=frm:1,sts:1";
  var username = document.search.username.value;
  var from = document.search.from.value;
  var to = document.search.to.value;
  if (query) url += \' \' + query;
  if (title) url += \' intitle:"\' + title + \'"\';
  if (username) url += \' %2B"Find all posts by \' + username + \'"\';
  if (forum) url += \' %2B"Board > Main > \' + forum + \'"\';
  if (recency) tbs += \',\' + recency;
  if (from && to) tbs += \',cdr:1,cd_min:\' + from + \',cd_max:\' + to;
  if (sorting) tbs += \',\' + sorting;
  url = url + tbs;
  google = document.getElementById("google");
  if (google) google.parentNode.removeChild(google);
  var tmp = document.createElement("iframe");
  tmp.setAttribute("id", "google");
  tmp.style.border = "0px";
  tmp.style.width = "100%";
  tmp.style.height = "75%";
  tmp.src = url;
  google = document.body.appendChild(tmp);
  document.getElementById("bookmark").href = url;
}
    </script>
    <title>Dope Search by alterego, choie, and Polerius</title>
  </head>
  <body>
    <center>
      <h3>Dope Search</h3>
      <form onsubmit="DopeSearch();return false" name="search">
        <select id="forum" onchange="SearchForum()">
          <option value="All forums" selected="selected">All forums</option>
          <option value="About This Message Board">ATMB</option>
          <option value="Comments on Cecil\'s Columns">CCC</option>
          <option value="General Questions">GQ</option>
          <option value="Great Debates">GD</option>
          <option value="Cafe Society">CS</option>
          <option value="The Game Room">TGR</option>
          <option value="In My Humble Opinion">IMHO</option>
          <option value="Mundane Pointless Stuff I Must Share">MPSIMS</option>
          <option value="The BBQ Pit">The Pit</option>
        </select>
        User: <input type="text" name="username" size="13%">
        <select id="recency" onchange="SearchRecency()">
          <option value="All times" selected="selected">All time</option>
          <option value="qdr:y">Last year</option>
          <option value="qdr:m">Last month</option>
          <option value="qdr:w">Last week</option>
          <option value="qdr:d">Last day</option>
        </select>
        From: <input type="text" name="from" size="7%">
        To: <input type="text" name="to" size="7%"> (M/D/YYYY) <br/><br/>
        Title: <input type="text" size="20%" name="title" onchange="UpdateTitle()">
        Query: <input type="text" size="30%" name="query" onchange="UpdateQuery()">

        <select id="sorting" onchange="SearchSort()">
          <option value="sbd:0" selected="selected">Sort by relevance</option>
          <option value="sbd:1">Sort by date</option>
        </select>
        <input type="submit" value="Search">
        <a id="bookmark" href="http://www.google.com/search?q=site:boards.straightdope.com&tbs=frm:1,sts:1,qdr:d&num=100">Link</a>
      </form>
    </center>
    <iframe id="google" frameborder="0" width="100%" height="75%" src="http://www.google.com/search?q=site:boards.straightdope.com&tbs=frm:1,sts:1,qdr:d&num=100"></iframe>
  </body>
</html>';

```

[Previous page](https://boards.straightdope.com/t/dope-search/505613.md?page=1)

[Next page](https://boards.straightdope.com/t/dope-search/505613.md?page=3)
