Hello,
I have already asked the question about this issue several weeks ago and got some reply from Nancy O. I've tried my best to solve my problem , according to her advices but I've failed!
My problem is:
I need to open many new browser windows within my website and while developping it, few years ago, I used Dreamweaver CS5 behaviour: "Open Browser Window". Everything is working fine except one feature: Clicking link the new window opens but the original page (this containing clicked link) reloads which is bad for me. I need to keep the original page in the same position where it was while link was clicked.
Nancy O. suggested to use JQuery FancyBox and I tried it, but my web site contain about 30 pages with many links to open new window in each and I cannot afford by now to rewrite my entire web site.
Please help mi to solve this issue!
Here is the URL of one o the pages of my website: http://www.szaser.com/Rod_Kozlakowskich.html
Do not be afraid it is in Polish!
Thanks to all in advance
Christophe Serdakowski
Hello Ken,
Thank you for your reply, but are you sure there is no solution for my problem?
What about the function used by DW behaviors?
function MM_openBrWindow( theURL,winName,features) { //v2.0
window.open(the URL,windowName,features);}
I saw several solutions on the web searching with Google for function MM_... argument, but they did not work for me. Maybe I did not use the proper parameters; I am not very good writing the Javascript?
I think the solution lays in "features" and I keep trying but to no avail until now. Maybe I should neme my windows and use somehow windowName parameter? Sofar I did not name my windows.
Before I start rewriting my entire site I try to check all posibilities to solve my problem quickly.
Sorry to bother you!
Christophe Serdakowski
There is a way you can fix your issue, it will require hand coding.
You can add a return false to your onclick events, like this...
<a href="#" onclick="MM_openBrWindow('new-window.html','window-name','width=500,h eight=500'); return false;">Your Link Here</a>
That "should" keep the opener page from shifting back to the top when the window.open link is clicked..
Christofe your answer lies in JavaScript and in Dreamweaver's excellent replace function.
Add the following code to the <head> area of all pages where you need to open something in a new window:
<script type="text/javascript">
function OpenNewWindow(bigurl, width, height)
{
var newWindow = window.open("", "pictureViewer",
"location=no, directories=no, fullscreen=no, " +
"menubar=no, status=no, toolbar=no, width=" +
width + ", height=" + height + ", scrollbars=no");
newWindow.document.writeln("<html>");
newWindow.document.writeln("<body style='margin: 0 0 0 0;'>");
newWindow.document.writeln("<a href='javascript:window.close();'>");
newWindow.document.writeln("<img src='" + bigurl +
"' alt='Click to close' id='bigImage'/>");
newWindow.document.writeln("</a>");
newWindow.document.writeln("</body></html>");
newWindow.document.close();
}
</script>
Now, anything you need to open in a new window, you can use the following JavaScript function:
<a href="#" onclick="OpenNewWindow('images/bigpicture.jpg', 500, 500); return true;">
<img src="images/smallpicture.jpg" alt="Click..."/>
</a>
You can format it for any size, I have it set for 500x500 pixels squre.
You can also change the newWindow.document.writeln statements to include everything from text, headers, footers and so on.
I would also mention that it's probably time for a redesign of your website anyway. Your drop-down menus cover other menus. And I would create a master page and make that a Dreamweaver Template, that way your "embiggerizor" JavaScript code can be put into all pages by default.
Hello Jon,
Thank you very, very much!!!! Its work as I wanted! My problem is solved and that in so simple way! I knew it should be simple but was unable to find the right script. Now I can continue to use my present my web site and slowly rewrite (or redesign) it as suggested by mhollis55!
Hello mhollis55,
I will try also your script but Jon Fritz II solved my headache so well that I will use his trick for the time being!
Thanks for all of you for the help.
Christophe
North America
Europe, Middle East and Africa
Asia Pacific