Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Homepage setting script doesn't work

Status
Not open for further replies.

Peahippo

MIS
Jul 18, 2003
91
0
0
US
I'm trying to counter my corporate network trying to keep my homepage set upon their Intranet.

I made this script:

Code:
  <SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
  <!-- to counter autoreset of homepage
  this.setHomePage('U:\homepage.html');
  //-->
  </SCRIPT>

... but it doesn't work. When I load the page the first time, and then click the homepage button, I get the MSN homepage for some bizarre reason.

What's wrong with my script?
 

As I understand it, the setHomePage function requires a a valid href. Try the following:
Code:
 this.setHomePage('file://U:\homepage.html');

Cheers,
Jeff
 
I made the change ...
Code:
<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
<!-- to counter autoreset of homepage
this.setHomePage('file://U:\homepage.html');
//-->
</SCRIPT>
... but it still doesn't work. I also put it into a link ...
Code:
<a class="chlnk" style="cursor:hand" HREF onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('file://U:\homepage.html');">Click here to make this page your default homepage</a>
... which when done, makes MSN the homepage. This is a funny result, since in the Tools | Internet Options dialog, it clearly says ...
Code:
file:///U:homepage.html
The only thing that works is MANUALLY going to the homepage file, then MANUALLY setting the homepage via the Tools | Internet Options dialog. When I do THAT, this is what it then says is the homepage ...
Code:
file:///U:/homepage.html
This raises 2 possibilities:

1. I'm running into an XP security policy. Which policy is stopping me from properly changing my homepage via javascript?

2. My code isn't properly putting "/" into the text string. Hence, "file://U:\homepage.html" isn't the correct syntax.
 

Yeah... I think this is correct here:
2. My code isn't properly putting "/" into the text string. Hence, "file://U:\homepage.html" isn't the correct syntax.

It's an escaping issue... easily fixed:
Code:
this.setHomePage('file:\/\/U:\/homepage.html');
This should show in the Tools/Home page setting as:
Code:
file://U:/homepage.html

Sorry for the confusion there,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top