Welcome to WebmasterWorld Guest from 34.203.245.76

Forum Moderators: open

Message Too Old, No Replies

onLoad script to hide address and menu bars?

     
9:48 pm on Sep 22, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 14, 2003
posts:1783
votes: 0


I've been searching all over for a working script that would hide the address bars and menu bars on a page when the page opens. I know how to do this with a link from another page, but I don't want to have all of that javascript in a link on another page.

Does anyone know of a working script that would do this?

Thanks for any replies.

3:23 am on Sept 24, 2007 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 26, 2004
posts:3178
votes: 22


Hide the address bar? You mean keep the user from knowing what site they are looking at? I'm about the most liberal person you'll encounter on what I will or will not use and that is something I would never do period.

- John

4:23 am on Sept 24, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 14, 2003
posts:1783
votes: 0


Hello, John. Here's what I would like to do:

I have several javascript tools that would be of value to other site owners within my niche. Some of these tools are available for free, as long as the creator gets his copyright stamp and a link back to his site. I'm a stickler for copyright issues, so there's no problem there.

Other tools are available for purchase. Again, no problem.

What I want to do is to give the other site owners within my niche these tools at no charge. All they need to do is insert a link into the text in a paragraph on a page that says something like, "To get an idea about how much you can save on widgets, please use our <a href="http://www.mysite.com/widget_calculator.html" target="_blank">Widget Calculator.</a>

What I also want to do is make it look like these tools are part of the other site owners' sites, rather than showing an address bar that many visitors would realize is not the address of the site they were on. If I can make the tools page look like it's part of the other site owners' sites, I know they will be more likely to add that <a href> link on some of their pages.

But the tools are still on my site, and I've either given the creator his link and copyright stamp, or I've paid him. It's no different than if the link was going to one of my pages that is obviously not part of the site that the visitor was at.

I've looked at some scripts available, and none seem to work properly. I could certainly do an onClick command in the link that I provide to the other sites, but that would defeat my purpose, which is to get link value from each of these sites.

I've also seen some Frankenstein scripts that use a combination of window.open and window.close commands that make the windows open and close so rapidly that it looks like fireworks.

All I'm really looking for is a popup script that works in reverse: the link is plain HTML, but the new window does the work of hiding the navigation bar and button bars.

Is such a script available?

4:42 am on Sept 24, 2007 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 26, 2004
posts:3178
votes: 22


There is intentionally no method to remove the address bar in IE7 so this technique is essentially dead to your IE7 crowd. I expect my site's share of IE7 to max out at about 8%-16% when IE6 drops below my Opera 8 shares. I'd recommend approaching the issue from a different perspective and probably educating the webmasters of the other sites how to correctly implement the scripts. I'm not sure why they aren't implemented to begin with?

- John

5:36 am on Sept 24, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 14, 2003
posts:1783
votes: 0


Thanks for the polite reply, John.

I guess what I want to do is not possible without using a script that would screw up most user's browsers.

As for why the sites in my niche wouldn't go out and buy or find these scripts themselves, it's because they don't have the time or expertise to install and test the scripts, or they just want something for free.

If you want to fully understand why I'm looking to do this, check out the "Links" forum, and look at the "links genius" topic I started.

If I pay even $25 for a good working script, and get several sites to link to that page on my site, it's worth it. Heck, I'd spend a couple of hundred dollars if I knew that I'd attract a lot of good quality links.

From my limited knowledge of javascript, I thought there would be a body onLoad command that would hide everything on a page except the page title.

I guess I was wrong.

7:00 pm on Oct 8, 2007 (gmt 0)

New User

10+ Year Member

joined:Oct 8, 2007
posts:1
votes: 0


The only way I know of to specify browser features is when executing "Window.open()".

Try this. Create a file containing the following.

<html> <head> </head> <body>
HI
</body>
<script tyle="text/javascript">
if (document.body.clientHeight!= 200)
{
window.open(document.location,"","menubar=no,toolbar=no,status=no,height=200,width=200");
window.opener = "me";
window.close();
}
</script>
</html>

9:31 am on Oct 9, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Welcome aboard frankliw, there are a couple problems with your example - the most painful being if this code is executed from the main window, the user will get as warning that another process is attempting to close the window. Warnings scare people. :-)

Here is how I would approach it, something like what Google does - provide your customers with a link of Javascript code, like this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
<!-- doctype all on one line please -->
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>External pop up</title>
</head>
<body>
<p> blah blah blah content and here is the link:<br>
<script type="text/javascript" src="external.js"></script>
<br>Go there now for some Really Cool Stuff.
</p>
</body>
</html>

Where external.js is the full URL to the following javascript file on your server:


var loc = 'external_pop_up.html'; // full URL to the calculator page
var h = '400'; //Window width and height
var w = '250';
function newWindow() {
var day = new Date();
var id= day.getTime();
var params = 'width='+w+',height='+h+',resizable';
var win=open(loc,id,params);
return false;
}
document.write('<a href="'+loc+'" onClick="return newWindow();">See my calculator<\/a>');

You would alter the variables w, h, and loc to suit your needs. Again, full URL to the calculator page in loc. What is here that is also missing from the previous example is setting the ID parameter in new window. This insures that a new window always opens when a link is clicked; if you set it blank '' or use the same name for an id, it will always open in that same window. Secondly, you don't need to specify yes or no for window parameters. If you leave them out as in my example, they won't be active. If you want them in, just add them to params (params='width=400,height=200,toolbars,resizable'; )

Then just make sure the calculator page in loc contains a close button:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
<!-- doctype all on one line please -->
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Calculator</title>
</head>
<body>
<form action="">
<p>My Calculator</p>
<input type="button" onClick="window.close()" value="close window">
</form>
</body>
</html>

This will still not hide the url in IE 7. But it is a way to simplify the link you ask the customer to place, it gives you control over the exact text and what files are requested.

Also if you test the above offline, you will get that annoying Active Script error from IE - it does not do this on a server. It just leaves the URL in, which is kinda the whole point of your question . . . .

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members