I'm trying to write a bookmarklet that takes the site the user is on, does some parsing and an ajax request, and opens a new window with that info as a param.
Here's what I've got:
<a href="javascript:
(function($)
{
var a, http, options, request, st, u;
u = document.location.hostname;
a = u.split('.');
st = a[a.length - 2];
path = 'http://ajax.googleapis.com/ajax/services/feed/find?callback=?&v=1.0&q=' + st;
$.ajax
({
type: 'GET',
url: path,
async: false,
dataType: 'json',
success: function(data)
{
var targ = data['responseData']['entries'][0]['url'];
window.open ('http://localhost:3000/bmfeed?targ='+targ,'menubar=1,resizable=1,width=350,height=250');
}
});
})(jQuery)
"> newwindow </a>
It finds the right url, but the new window is blocked by the popup blocker.
If instead I just have
<a href='javascript: window.open ("http://localhost:3000?targ=asdfasdf","mywindow","menubar=1,resizable=1,width=350,height=250");'> oneline </a>
it opens a new tab uninhibited. I assume that the difference is that i'm doing some parsing in the first example, which the browser doesn't like.
Is there a way to have my cake and eat it too? Thanks a bunch!