2011-05-27 17 views
5

में अनुरोधित आकार नहीं है क्रोम में पॉपअप विंडो खोलते समय, इसका अनुरोध अधिकांश समय के लिए नहीं किया जाता है। पहली बार लगता है कि मैंने खिड़की को सही आकार खोल दिया है, लेकिन अगर मैं इसे बंद करता हूं और इसे फिर से खोलता हूं, तो यह सब आकार से बाहर निकलता है।जावास्क्रिप्ट विंडो। क्रोम

क्या क्रोम के साथ मुझे कुछ खास करने की ज़रूरत है?

उत्तर

0

इस भर में गलती, आप के लिए अच्छा हो सकता है:

http://roneiv.wordpress.com/2008/01/18/open-a-popup-window-in-javascript-with-windowopen-crossbrowser-solution/

var myPopupWindow = ''; 
function openPopupWindow(url, name, width, height) 
{ 
    //Remove special characters from name 
    name = name.replace(/\/|\-|\./gi, ""); 

    //Remove whitespaces from name 
    var whitespace = new RegExp("\\s","g"); 
    name = name.replace(whitespace,""); 

    //If it is already open 
    if (!myPopupWindow.closed && myPopupWindow.location) 
    { 
     myPopupWindow.location.href = encodeUrl(url); 
    } 
    else 
    { 
     myPopupWindow= window.open(encodeUrl(url),name, "location=no, scrollbars=yes, resizable=yes, toolbar=no, menubar=no, width=" + width + ", height=" + height); 
     if (!myPopupWindow.opener) myPopupWindow.opener = self; 
    } 

    //If my main window has focus - set it to the popup 
    if (window.focus) {myPopupWindow.focus()} 
} 
0

आप अपने पॉपअप विंडो नामित किया है? मुझे लगता है कि क्रोम में विंडोज़ को याद रखने के लिए कुछ तर्क है कि यह पहले ही खोला गया है और ऐसा लगता है कि यह आपके पॉपअप के साथ हस्तक्षेप कर सकता है, इसलिए यह पहली बार सही तरीके से काम कर रहा है। मैं सुझाव देता हूं कि पॉपअप विंडो को नाम देने का प्रयास न करें।

संबंधित मुद्दे