/    Sign up×
Community /Pin to ProfileBookmark

force bookmarklet to open a new window

I am trying to force this bookmarklet to open the info in a new window. What it does now is just forward to a “blank” page that contains the data from the page I need.

Thanks in advance,
Tony

[CODE][DEFAULT]
BASEURL=http://www.mysanantonio.com
[InternetShortcut]
URL=javascript:adBookmarkletData
IDList=
HotKey=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,15[/CODE]

If it helps to see it in action it will work from here if you save the above code as a bookmark.
[URL=”http://blogs.mysanantonio.com/weblogs/courtside/”]http://blogs.mysanantonio.com/weblogs/courtside/[/URL]

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@rnd_meMay 19.2009 — that's not a bookmarklet...
Copy linkTweet thisAlerts:
@MakeItRightauthorMay 20.2009 — Yeah, I've learned that.

Here is the bookmarklet:
[CODE]javascript:var adBookmarkletData=[];adBookmarkletData.push('<html><head><title>MYSA Yahoo! APT Debugger</title></head><body><center><div style="background:#ccc;color:#000;width:350px;text-align:left;padding:15px;border:2px #000;">');adBookmarkletData.push('<b>MYSA Yahoo! APT Debugger:</b><br /><hr />');adBookmarkletData.push('<b>URL:</b> '+document.location.href+'<br />');adBookmarkletData.push('<b>Pub ID:</b> '+window.yld_mgr.pub_id+'<br />');adBookmarkletData.push('<b>Site Name:</b> '+window.yld_mgr.site_name+'<br />');adBookmarkletData.push('<b>Content Topic ID List:</b> '+window.yld_mgr.content_topic_id_list+'<br />');adBookmarkletData.push('<b>Site Section Name List:</b> '+window.yld_mgr.site_section_name_list+'<br />');for(i in window.yld_mgr.slots){ adBookmarkletData.push('<b>AD:</b> ('+i+') <b>Category:</b>('+window.yld_mgr.slots[i].cstm_content_cat_list+')<br />');};adBookmarkletData.push('</div></center></body></html>');function createAptDebugger(){for (i in adBookmarkletData){document.write(adBookmarkletData[i]);}};void(createAptDebugger());[/CODE]

This code will work against any page at www.mysanantonio.com

How do I get this to open the results in a new window instead of doing what it does now.
Copy linkTweet thisAlerts:
@MakeItRightauthorMay 20.2009 — I am not sure where to put the window.open and not sure I understand how it knows to maintain the data from the original page.

To make it more readable for this post here it is formatted:
[CODE]javascript:
var adBookmarkletData=[];
adBookmarkletData.push('<html><head><title>MYSA Yahoo! APT Debugger</title></head><body><center><div style="background:#ccc;color:#000;width:350px;text-align:left;padding:15px;border:2px #000;">');
adBookmarkletData.push('<b>MYSA Yahoo! APT Debugger:</b><br /><hr />');
adBookmarkletData.push('<b>URL:</b> '+document.location.href+'<br />');
adBookmarkletData.push('<b>Pub ID:</b> '+window.yld_mgr.pub_id+'<br />');
adBookmarkletData.push('<b>Site Name:</b> '+window.yld_mgr.site_name+'<br />');
adBookmarkletData.push('<b>Content Topic ID List:</b> '+window.yld_mgr.content_topic_id_list+'<br />');
adBookmarkletData.push('<b>Site Section Name List:</b> '+window.yld_mgr.site_section_name_list+'<br />');
for(i in window.yld_mgr.slots){
adBookmarkletData.push('<b>AD:</b> ('+i+') <b>Category:</b>('+window.yld_mgr.slots[i].cstm_content_cat_list+')<br />');
};
adBookmarkletData.push('</div></center></body></html>');
function createAptDebugger(){
for (i in adBookmarkletData){document.write(adBookmarkletData[i]);}
};
void(createAptDebugger());[/CODE]


Thanks in advance and sorry for the dumbness above.
Copy linkTweet thisAlerts:
@rnd_meMay 21.2009 — [CODE]
var adBookmarkletData=[
'<html><head><title>MYSA Yahoo! APT Debugger</title></head><body><center><div style="background:#ccc;color:#000;width:350px;text-align:left;padding:15px;border:2px #000;">',
'<b>MYSA Yahoo! APT Debugger:</b><br /><hr />',
'<b>URL:</b> '+document.location.href+'<br />',
'<b>Pub ID:</b> '+window.yld_mgr.pub_id+'<br />',
'<b>Site Name:</b> '+window.yld_mgr.site_name+'<br />',
'<b>Content Topic ID List:</b> '+window.yld_mgr.content_topic_id_list+'<br />',
'<b>Site Section Name List:</b> '+window.yld_mgr.site_section_name_list+'<br />'];
for(i in window.yld_mgr.slots){
adBookmarkletData.push('<b>AD:</b> ('+i+') <b>Category:</b>('+window.yld_mgr.slots[i].cstm_content_cat_list+')<br />');
};
adBookmarkletData.push('</div></center></body></html>');
function createAptDebugger(){
var pu=window.open("");
pu.onload=function(){
pu.document.write(adBookmarkletData.join(""));
}
};
void(createAptDebugger());

[/CODE]



you'll probably have to remove any linebreaks for the bookmarklet version...
Copy linkTweet thisAlerts:
@MakeItRightauthorMay 21.2009 — It opens a window but it is totally blank. Just <html></html> in the source. I appreciate your efforts and time.

Also, it does not open a window in FF just a tab.

Tony
Copy linkTweet thisAlerts:
@rnd_meMay 21.2009 — It opens a window but it is totally blank. Just <html></html> in the source. I appreciate your efforts and time.

Also, it does not open a window in FF just a tab.

Tony[/QUOTE]


can't do anything about firefox's behavior, but i can fix the blankness:
[CODE]
function createAptDebugger(){
var pu=window.open("");
if(pu.document){
pu.document.write(adBookmarkletData.join(""));
}else{
pu.onload=function(){
pu.document.write(adBookmarkletData.join(""));
}
}
};

[/CODE]
×

Success!

Help @MakeItRight spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...