Open new window without title & address bars in firefox

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: May 2009
Posts: 3
Reputation: Baddesley is an unknown quantity at this point 
Solved Threads: 0
Baddesley Baddesley is offline Offline
Newbie Poster

Open new window without title & address bars in firefox

 
0
  #1
Aug 31st, 2009
Hi everyone, hope someone can help. I'm very much a beginner in Javascript and 'ok' in html but just cannot get a new (picture) window to open in Firefox without the title and address bars (or anything else, just the image). IE shows just the title bar, with or without the code:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function newWindow()
  2. {window.open('./pageaddress.html','winname','top=20,left=20,directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=350');}
  3. </script>

The window opens fine, but always shows the address and title bars. I have read the W3 Schools options list (and other posts) and tried both 'no' and '0' as values, without any success. What am I missing and is there any way to make this work - it didn't even work in the W3 Schools 'try it yourself' test page!

I have seen some very nice 'slowly-opening' windows (increasing in size), which would be even better, any links to info on these would also be much appreciated. Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 817
Reputation: Airshow is on a distinguished road 
Solved Threads: 116
Airshow's Avatar
Airshow Airshow is offline Offline
Practically a Posting Shark

Re: Open new window without title & address bars in firefox

 
0
  #2
Aug 31st, 2009
Baddesley,

I can only imagine that this is the result of some FF setting - "always open windows with full title bar" or similar. If so, then you could correct it for yourself but some other users will still see the original behaviour.

A workaround would be to show/hide an absolutely positioned div in your main window, such that it sits on top of all other content. Such a "window" can be populated with content using DHTML/DOM methods and will be "modal" in behaviour by default. You will need to include a "close" button/link such that, once displayed, it can be re-hidden.

Alternatively, maybe someone knows something more than I about window.open in FF.

Airshow
Last edited by Airshow; Aug 31st, 2009 at 2:41 pm.
50% of the solution lies in accurately describing the problem!
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 3
Reputation: Baddesley is an unknown quantity at this point 
Solved Threads: 0
Baddesley Baddesley is offline Offline
Newbie Poster

Re: Open new window without title & address bars in firefox

 
0
  #3
Aug 31st, 2009
Thanks for the quick reply Airshow, but yes, I do need a fix that works for everyone, no matter what their (or my) local FF setting are.

I'm not sure what you mean about the 'modal' behaviour of hiding the bars behind an absolutely positioned div, but it doesn't sound like the way I want to go. Many sites have click(or hover)-to-open, plain, unadorned new-window (larger) images for products - which s what I want it for - so it must be possible. Hopefully, someone else will know. Thanks anyway.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: Open new window without title & address bars in firefox

 
0
  #4
Sep 1st, 2009
Hi,

obtaining Airshow's suggestion of the DOM procedure over the document and also i've applied some iframes to simulate real window experience:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta http-equiv="Content-Script-Type" content="text/javascript">
  7. <title>www.daniweb.com</title>
  8. <style type="text/css">
  9. <!--
  10. body { min-height : 600px; }
  11. -->
  12. </style>
  13. <script type="text/javascript">
  14. <!--
  15. function newWindow( p, w, h, e ) {
  16. var e = e ? e : window.event;
  17. var x = 0;
  18. var y = 0;
  19. if ( e.pageY || e.pageX ) {
  20. x = e.pageX;
  21. y = e.pageY;
  22. } else if ( e.clientX || e.clientY ) {
  23. var db = document.body;
  24. var dde = document.documentElement;
  25. x = e.clientX + db.scrollLeft + dde.scrollLeft;
  26. y = e.clientY + db.scrollTop + dde.scrollTop;
  27. }
  28. var p = p;
  29. var w = w;
  30. var h = h;
  31. var name = "iframeOne";
  32. var id = name;
  33. if (( "createElement" && "getElementById" ) in document ) {
  34. var fragment = document.createDocumentFragment();
  35. var win = document.createElement("div");
  36. var iframe = document.createElement("iframe");
  37. var settings = {
  38. frameBorder : 0,
  39. noResize : 0,
  40. marginHeight : 0,
  41. marginWidth : 0,
  42. width : w,
  43. height : h,
  44. style : "position : relative",
  45. name : name,
  46. id : id
  47. };
  48. win.setAttribute( "style", "width : " + w + "px; height : " + h + "px; position : absolute; top : " + y + "px; left : " + x + "px; border : 1px solid #C0C0C0" );
  49. win.appendChild( iframe );
  50. for ( var properties in settings ) {
  51. if ( iframe[ properties ] ) {
  52. iframe[ properties ] = settings[ properties ];
  53. continue;
  54. } iframe.setAttribute(( properties ).toLowerCase(), settings[ properties ] );
  55. } fragment.appendChild( win );
  56. document.body.appendChild( fragment );
  57. iframe.src = ( function( url ) {
  58. var path = new Image;
  59. path.src = url;
  60. return path.src;
  61. } )( p );
  62. }
  63. }
  64.  
  65.  
  66.  
  67. //-->
  68. </script>
  69. </head>
  70. <body>
  71. <noscript>
  72. <p> This site requires a browser that support <b>JavaScript</b>. </p>
  73. </noscript>
  74. <div id="div">
  75. <input type="button" value="simulate window" onclick="newWindow( 'test.html', 300, 300 );"></div>
  76. </body>
  77. </html>
hope it gets what you need.
Last edited by essential; Sep 1st, 2009 at 6:06 am.
Dev.Opera — FOLLOW THE STANDARDS, BREAK THE RULES...
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 3
Reputation: Baddesley is an unknown quantity at this point 
Solved Threads: 0
Baddesley Baddesley is offline Offline
Newbie Poster

Re: Open new window without title & address bars in firefox

 
0
  #5
Sep 5th, 2009
Thanks Essential.

I'll have a go, but it looks unbelieveably complicated to me - I'm very much a beginner at JavaScript! What I was really afer was to see if anyone had any idea why the standard W3 options for the 'window.open' function (as above) simply don't work - they are very simple and are supposed to work!
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC