3 Replies Latest reply on Jun 28, 2012 6:34 PM by Production Monkey

    goToNetPage fails on Mac Safari and FF


      Hi all


      I'm trying to open a local html file with the old and good goToNetPage which alaways works pretty well on Windows but I can't get it to work on the Mac.


      i have Safari as my default browser on Mac and the following behavior attached on a sprite



      on mouseUp me

      goToNetPage "htms/myfile.htm"



      gives me this error: Safari can't find the server. Safari can't open the page "http://htms/myfile.ht" because Safari can't find the server "htms".


      In short Safari isn't treating the html as a local one  and is apending the http instead of file:///



      I also tried this:


      on mouseUp me

      goToNetPage the MoviePath & "htms/myfile.htm"




      and now i have this in my address bar




      but got another error:

      Safari can't open "Macintosh%20HD:Users:wilsoncortezribeiro:Desktop:Nova%20pasta:Root:htms/myfile.htm" because the first character of its  addres is not valid


      I have this behavior in my first frame:


      on startMovie

      global gPlatform, gDelimiter

      if the platform contains "Windows" then



      else if the platform contains "Macintosh" then






      end if




      as i need this project to run in both win and mac but no way. If i set Firefox as my default browser (Mac) things get worse..... firefox doesn't open at all.


      So, what you guys could tell me to try? I'm near a deadline and stucked :-(


      BTW I also ttried with the Budy Api

      set OK = baOpenURL( "htms/myfile.htm" , "maximised" )    and this prints the error regarding not being able to find "htms server" along with a very weird bunch of characters like %00%00%00 appended to the address (path) of the file.



      Director 11.5 Mac OS Lion 10.7.4

        • 1. Re: goToNetPage fails on Mac Safari and FF
          Production Monkey

          You need a function that will convert your relative path into a valid full path that the browser understands.  I wrote up the function below to get you started. I don't have a mac to test it on, but on my windows box it seems to produce the correct result.



          on convertToMacFullLocalUrl  RelativePath

            LocalUrl =  "file:///Volumes/"

            Delim = "/"

            _player.itemDelimiter = ":"


            FullPath = _movie.path & RelativePath


            -- Pull out all the path info minus the delimiter


            repeat with index = 1 to FullPath.items.count


            end repeat


            -- reassemble the path in a local URL format

            repeat with Tok in Tokens

              LocalUrl = LocalUrl & Tok & Delim

            end repeat


            -- remove delimiter at end of string

            delete  LocalUrl.char[LocalUrl.char.count]


            return LocalUrl

          end convertToMacFullLocalUrl

          • 2. Re: goToNetPage fails on Mac Safari and FF
            zedascouve Level 1

            Thank you very much for your time :-)


            Well I've resolved this with buddyApi Xtra using baOpenFile and not baOpenURl as i was used to.

            So the straight forward "OK = baOpenFile( the moviePath & "myfile.htm" , "maximised" )" did the trick


            Anyway could you tell me where i need to put this nice function you've kindy wrote? I' d like to try It out.


            Once again, thank You.

            • 3. Re: goToNetPage fails on Mac Safari and FF
              Production Monkey Level 3

              I would do something like:



              LocalUrl = convertToMacFullLocalUrl("myfile.htm")


              Okay =  baOpenURL(LocalUrl , "normal")


              if Not(Okay) then

                  alert "There was a problem connecting with the web page. "

              end if