• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

on window open set focus on it

<A  class="bookmarklet" HREF="javascript:void(myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');myRef.focus();)">
<b>anything</b></A>
i have added myRef.focus(); but this link is not workin my requirement is to drag this link to firfox tool bar and focus on this window plz check the error in upper link i have provided to u
and please solve it.
0
naeembhatti
Asked:
naeembhatti
  • 6
  • 3
  • 3
  • +1
1 Solution
 
thirdCommented:
try this,

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Author: Third Santor</title>
<script>
  function openWin(url){
    var myRef = window.open(url, 'Bookmarklet', 'menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');
    myRef.focus();
  }
</script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">

<A  class="bookmarklet" HREF="#" onclick="openWin('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href));return false;">
<b>anything</b></A>
</body>
</html>

i moved the script to a function to make the code more readable.
0
 
naeembhattiAuthor Commented:
no i said that i am using this link as a bookmarklet so i need it in herf=""
please give me solution in it .
0
 
Michel PlungjanIT ExpertCommented:
HREF="javascript:void(myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar,status,scrollbars,,resizable,width=530,left=200').focus())">
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
naeembhattiAuthor Commented:
yes this is right but please test it in firefox having drag it on its tool bar
it is not focusing on the pop up window which we opened.
focus is not working ? on herf on firefox?
0
 
callrsCommented:
<A  class="bookmarklet" HREF="javascript:(function(){myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');myRef.focus();})()">
<b>anything</b></A>
0
 
naeembhattiAuthor Commented:
hi callrs it is not focusing on firefox ?
just make a page and paste ur code in it and drag it "anything" hyperlink to ur toolbar of firefox but it is not focusing on it?
0
 
callrsCommented:
You're right. Window opens but loses focus..
0
 
naeembhattiAuthor Commented:
ok now please give me a solution this is my problem callrs.
0
 
callrsCommented:
<A  class="bookmarklet" HREF="javascript:(function(){myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');setTimeout('myRef.focus()',50);})()">
<b>anything</b></A>
0
 
Michel PlungjanIT ExpertCommented:
The simple solution is to add a focus to the onLoad in your bookmarklet/index.php
0
 
naeembhattiAuthor Commented:
thanks to u all.
yes this is nice solution mplungjan but before loading of window i have 5 functions to run so it takes much time to load it thank u again.
0
 
Michel PlungjanIT ExpertCommented:
<html>
<head>
<script>
window.focus()
.
.
.
</script>
0
 
naeembhattiAuthor Commented:
oh , right. yes it is true thank u mplungjan.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now