943,885 Members | Top Members by Rank

Ad:
Aug 31st, 2009
0

Open new window without title & address bars in firefox

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Baddesley is offline Offline
3 posts
since May 2009
Aug 31st, 2009
0

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

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.
Sponsor
Reputation Points: 318
Solved Threads: 358
WiFi Lounge Lizard
Airshow is offline Offline
2,526 posts
since Apr 2009
Aug 31st, 2009
0

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

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Baddesley is offline Offline
3 posts
since May 2009
Sep 1st, 2009
0

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

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.
Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008
Sep 5th, 2009
0

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

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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Baddesley is offline Offline
3 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Script.aculo.us -- Having issues using effect.queues in conjunction with callbacks.
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Ajax - Third party web content





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC