homepage Welcome to WebmasterWorld Guest from 54.211.190.232
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Javascript Discussions
tedster




msg:1495294
 11:41 pm on May 19, 2001 (gmt 0)

>> Is it safe to assume that any javascript code that has a section to be put into the <head> of my page can be made into an external javascript file? <<

Yes, it's a pretty safe assumption.

>> Is there an advantage to doing this--making my javascripts external <<

1. It brings your content closer to the top of the html page. This is great for the spiders. Sometimes when there is lots of js on the page, they never get to your content at all, and you end up with only the js in their database!

2. Write the javascript once and call it from any page on the site -- instead of re-writing it on every page that needs the function.

3. The js file is cached by the client, meaning that after one download, all other pages will load faster.

>> "using a js redirect in an external file none of the engines will know this if it is external..."

I've heard this. Won't the search engines index the page that you are re-directing to instead of the actual page? <<

No, the spiders almost never call the js file and will not see the redirect URL at all. Right now search engines would have a lot of security issues trying to automatically run your js on their machines to find out what it does.

Google has said they "reserve the right to check your js in the future", but even this technical monster doesn't routinely check js files right now.

 

Black Knight




msg:1495295
 11:47 pm on May 19, 2001 (gmt 0)

Google was however recognising javascript redirection when embedded in a page, which is when I started using only external javascript files.

optimizing123




msg:1495296
 12:11 am on May 20, 2001 (gmt 0)

>> Is it safe to assume that any javascript code that has a section to be put into the <head> of my page can be made into an external javascript file? <<

So the head section is safe. What about the <body>. Are external js files safe to use in the body area?

Black Knight




msg:1495297
 12:14 am on May 20, 2001 (gmt 0)

At the current time spiders do not pull external .JS files at all, no matter where you embed the tag to call them.

The best part about external .JS files is that if a spider does ever want to look at your .JS files, your logs will tell you about it, allowing you to know that whatever spider is suddnly interested in javascript for some reason. That's a handy alarm system to have.

ponytale




msg:1495298
 8:34 am on May 22, 2001 (gmt 0)

i need javascript to selfclose a popup window after login (the login opens a new window)

help would be appreciated !!

Drastic




msg:1495299
 3:42 pm on May 22, 2001 (gmt 0)

Hi ponytale, welcome to WebmasterWorld.

Find everything you need to know (and them some) about controlling windows with javascript here [developer.irt.org].

mdharrold




msg:1495300
 2:27 am on May 24, 2001 (gmt 0)

I have a pop up window that will not scroll. I have placed "scrollbar=yes" in the script and still no bar. Is there any reason why this would be happening?

tedster




msg:1495301
 5:34 am on May 24, 2001 (gmt 0)

First thing to check, make sure there are no spaces at all in the feature string for the new window. Also, sometimes it works better to use scrollbars=1 instead of scrollbars=yes. I don't have a clue why, but it's true!

tedster




msg:1495302
 7:12 am on May 24, 2001 (gmt 0)

I just noticed that you wrote scrollbar=yes. The actual feature is scrollbars=yes (with an "s") If this wasn't just a typo in your post, then that's most likely the problem.

mdharrold




msg:1495303
 9:50 pm on May 24, 2001 (gmt 0)

I just looked and I am using the "s". I did find my problem was that I was calling the script in perl and forgot to escape a character.

Thanks for the help.

tedster




msg:1495304
 6:53 am on Jun 25, 2001 (gmt 0)

CLOSING A POP-UP WINDOW

ponytale asked:
>> i need javascript to selfclose a popup window after login (the login opens a new window) <<

My apology to ponytale -- this question was ignored for an entire month. A very belated welcome to the Forum, and I hope this information helps, now or in the future.

The javascript method for closing a window is window.close().

If you use it to close a window that your javascript code opened (the popup in this case) it works without presenting a confirmation alert window. If you use it to close a window that your js didn't open, the user will automatically get the request to confirm the close.

To close the pop-up window when the user's login is submitted, you could call it by including the onSubmit() event handler in the login FORM tag:

<form name="loginform" onSubmit()=window.close()>form content goes here</form>

However, that code might be problematic if the submitted login doesn't validate. You could account for that possibility by having a failed login generate its own, new popup window for the failure message.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved