?
Solved

Setting Browser Attributes onLoad

Posted on 2003-03-31
13
Medium Priority
?
459 Views
Last Modified: 2011-10-03
I am needing to use a script that will resize the window of a page when it loads and also set the attributes such as 'scroll bars', 'navigation bar', 'status bar' and so on. Here's what I have to resize the window, pretty basic.

<script language="JavaScript">
onLoad= 'javascript:window.resizeTo(572,400)'
</script>

I will have various people updating links in a page using Macromedia Contribute (first mistake, oh well) and in Contribute you can't put a script (no scripts at all)for a simple window.open with all the attributes set. So I was planning on making the new window that pops up from a basic link to have the attributes already set such as the code for the window size that I have above.

I did find this when searching here, but I can't get it to work when this is not really a window.open

<SCRIPT>
self.menubar.visible=false;
self.toolbar.visible=false;
self.locationbar.visible=false;
self.personalbar.visible=false;
self.scrollbars.visible=false;
self.statusbar.visible=false;
</SCRIPT>

Thanks
0
Comment
Question by:fly2079
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
13 Comments
 
LVL 14

Accepted Solution

by:
avner earned 152 total points
ID: 8243303
fly2079,
Any other properties of a window a part from the size and location.

The only way to do it is to open a a new window and then the way you want the window to be :

<script>
var oWin = window.open("http://www.yahoo.com","test","addressbar=0,statusbar=0");
</script>

This is due to security issues, you cannot change the settings of a window that "you" did not open.
0
 
LVL 5

Assisted Solution

by:kasandra
kasandra earned 148 total points
ID: 8243462
ditto avner - you can't do it without using window.open.
0
 
LVL 7

Expert Comment

by:cubrovic
ID: 8248179
if your not opening page with open you can still set the size of the window and scrolling.
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 1

Author Comment

by:fly2079
ID: 8251018
What about an alternative? Is there a way to pop up a new window using a script with window.open with all the properties pre-set except the actual url, then using a style sheet to set the link to run the javascript code with the url parameter in the null link? ie. having a link reference #001 instead of just # and then applying a style from css to run the code which could pick up the 001 from the null link and make it open new browser with all options set and add .html to make it 001.html? This may be confusing and I'm sorry, just trying to work it out with Macromedia Contribute and still keep the style of the website. The user will only be able to change the href property in a new link put on the page but I'd like it so that it will open in new window with pre set size and scrollbars, nav bar, status bar, etc.
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8251038
You can't use javascript in a stylesheet.
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8251063
If you can't use scripts at all, I don't think there is anyway you can work around it, because either way you go you need to use a script.

If you do open a new window using window.open yes you can populate it later (you should be able to target it <a href="blah.html" target="winname">) but you still need to run a script somewhere to open the window in the first place..?
0
 
LVL 7

Expert Comment

by:cubrovic
ID: 8251071
Maybe you can try onload opening new window (with all properties set) and then put content from opener to popup like this:

var w = window.open(...)
var h = document.getElementsByTagName("html").firstChild.innerHTML
w.document.open()
w.document.write("<html>"+h+"<\/html>")
w.document.close()

but when you open this popup you cannot close the opener window if user dont approved that but maybe you can redirect this page to "blank.html" or something like this...
0
 
LVL 14

Expert Comment

by:avner
ID: 8251911
fly2079 , there is no work around.
You can only change properties of a new window.

The work around you tried to explain was very wierd if you can try and further explain.
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8258051
If I understand what fly2079 is proposing, is to open a new window using window.open without specifying a URL, and then later specifying a URL. Is this correct?

Reiterating what I said above, while this _could_ work, in that you could target the window without using a script by using something like:
<a href="contentfornewwin.html" target="newwin">

you still need to use window.open to launch the new window at some point. But if you can't use a script to launch a new window from the link, I don't know how this "work around" would be any different, because you still need to use a script somewhere to launch the target window...

fly2079, if you can't use a script, there is no way that what you are asking can be done. You can open a new window without using javascript, but you can't set its attributes.

Can you not use Dreamweaver to add the script in? Checking information about Macromedia Contribute on the Macromedia website, you can "administer Contribute sites from within Dreamweaver MX"...
0
 
LVL 1

Author Comment

by:fly2079
ID: 8258368
I guess I'm out of luck, I can administer the site with dreamweaver but then I'd have to update all the links that a user puts in and put the code in every time they update the page. I guess I should start looking for some Contribute forums for a workaround. Thanks for all the help.
0
 
LVL 1

Author Comment

by:fly2079
ID: 8258376
I guess I'm out of luck, I can administer the site with dreamweaver but then I'd have to update all the links that a user puts in and put the code in every time they update the page. I guess I should start looking for some Contribute forums for a workaround. Thanks for all the help.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 10137376
fly2079,
No comment has been added lately (289 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: split points between avner http:#8243303 and kasandra http:#8243462
for effort.

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

mplungjan
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question