# JavaScript on text links... Doesn't work on local pages?



## MDLarson (Apr 11, 2003)

Page:  http://www.larsonsystems.com/products/ect/
Click on any option or accessory in the table towards the bottom.

This is weird.  I developed the HTML in Dreamweaver MX (in OS 9.)

I have been testing my pages in IE 5 (in OS 9,) on a local copy using relative links.  I attach behaviors to text links using a procedure suggested by Macromedia (see technote 15495.)

I attach the Behavior "Open Browser Window" to many options on my product pages, and it works great.  I can click the links successfully on a live web site on the following systems:

Windows 95 / Internet Explorer 5?
Windows XP / Internet Explorer 6
Mac OS 9 / Internet Explorer
Mac OS X 10.2.5 / Internet Explorer 5
Mac OS X 10.2.5 / Netscape 6
Mac OS X 10.2.5 / Safari 1.0 Beta
Mac OS X 10.2.5 / Chimera / "Navigator" 0.2.7
Mac OS X 10.2.5 / OmniWeb 4.1 Beta 6

OK, so the links work on a real live website.  But when I try to load a local copy of the website on my OS X machine, the links are *dead!*

I tried replacing "javascript:;" with "javascript:void(0)" and "#" according to another MM Technote, but that didn't work either.

My question is this:  Is there any Javascript issue with Mac OS X that prohibits my links from working correctly on a local HTML file?

p.s.  I'm trying to get my iMac ready for a tradeshow.  I'm leaving this weekend, so any response will probably not make it, but I'm hugely curious about this issue.


----------



## lurk (Apr 11, 2003)

Are you serving the pages to yourself via the local web server i.e. http://localhost/~yername/coolpage.html  or as a file via file:///Users/yername/lousypage.html

If you aren't using the local server then try that.

-Eric


----------



## MDLarson (Apr 11, 2003)

> _Originally posted by lurk _
> *Are you serving the pages to yourself via the local web server i.e. http://localhost/~yername/coolpage.html  or as a file via file:///Users/yername/lousypage.html
> 
> If you aren't using the local server then try that.
> ...


Hmm, that's a good suggestion.  I believe draggin'-n-droppin' pages defaults to the file:/// method.  I'll try it out.


----------



## TommyWillB (Apr 13, 2003)

1) I'd definately reccomend the # thing in your HREF attributes. Since you are doing all of the work in OnClick.

2)  Your JavaScript function has some redundant/nested comment tags. They should not hurt, but can not help:
	
	



```
<script language="JavaScript">
<!--
<!--
function MM_reloadPage(init)  { ... }
MM_reloadPage(true);
// -->

function MM_openBrWindow(theURL,winName,features) { ... }
.
.
.
//-->
</script>
```


I DID download this page locally and it works as expected (no images, css, etc) with IE/OS X 10.2.5. The little windows poped up and tried to load the other pages.

Maybe there is some security thing in your browser that does not let scripting (JavaScript) run locally? Or if you are in Safari, maybe the pop-up blocker behaves differently for local pages than for server-based ones.


Like MDLarson said... you can dump all of your files in /Library/WebServer/Documents/ turn Web Sharing (Apache) on, and then load them from http://localhost/ ...Or you can edit your /etc/httpd/httpd.conf file to make your Dreamweaver folder your Apache docroot.


----------

