The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

default homepage in Firefox

I'm looking for a script (javascript) that, after the user clicks in a button, the page will be the default one. I found several scripts, but they only work in Internet Explorer and not in Firefox 1.0.4. Can someone help me please?

Javascript can only access the current web page and read a few things from the browser such as window size and screen resolution. Javascript is available in many popular browsers the biggest exception being Internet Explorer which provides JScript instead of Javascript.

JScript has more access to both the browser and Operating System since it only runs on Internet Explorer which is integrated into the Windows Operating System and therefore allows such access. Of course any sensible person has their security settings set to disallow this access since a web page should not have access to anything outside of the page.

I'm looking for a script (javascript) that, after the user clicks in a button, the page will be the default one. I found several scripts, but they only work in Internet Explorer and not in Firefox 1.0.4. Can someone help me please?

Just to confirm, Firefox doesn't support the set as homepage and add to favorites JavaScripts. Actually though it's a good thing because isn't annoying when you stumble across one of those horrid all ads, spam sites that try to install spyware and reset your homepage?

Originally Posted by rwar

Just a doubt: if I'm emulating IE with Wine on some Linux distro, for example, can I have this funcionality?

You should be able to do that since it's a IE thing and not OS dependent.

Just to confirm, Firefox doesn't support the set as homepage and add to favorites JavaScripts. Actually though it's a good thing because isn't annoying when you stumble across one of those horrid all ads, spam sites that try to install spyware and reset your homepage?

In that case, I agree with you. Not that I use it, but it's another funcionality to the browser. As FF has anti-popup, it would be nice to implement that. Don't you think?

Originally Posted by pentapenguin

You should be able to do that since it's a IE thing and not OS dependent.

Recent incarnations (5+ to be sure) of Internet Explorer support Javascript as well.

No that is Microsoft JScript which is a Javascript lookalike that will process most Javascript code correctly but handles a few things differently as well as providing a number of extra commands not available in Javascript.

For example:

Javascript:

var ajaxObj = new XMLHttpRequest();

JScript:

var ajaxObj = new ActiveXObject('Microsoft.XmlHttp');

The biggest incompatibility problem is that JScript automatically maps a lot of fields to make it easier to access them so that if you have a Javascript variable and an id of the same name in your HTML. You can't have the same name for both with JScript because JScript will overwrite one with the other in the extra field mappings that it applies.

The difference in the code stated above is that the 2nd one is using Javascript to create an ActiveX object, which is an IE specific feature. You'll want to note that the first snippet works in IE7's early betas, since they've finally decided to expose the XMLHTTPRequest object.

Look at the MSDN page for JScript and tell me where all the common Javascript methods are. Also, the MSDN pages for IE will tell you that versions 5+ support Javascript.

After doing a very tiny amount of testing, it appears that I may have been incorrect, or at least a little off in my estimation.

It seems that JScript specific calls (like the ScriptEngine() function) will work in Internet Explorer regardless of the language attribute in the script tag.

I was correct, however, in my assumption that JScript is useful outside of an 'Internet Explorer Only' environment, as it can be used with the WSH (much like VBScript) to perform routing shell operations.