OpenURL and anchors
BlitzMax Forums/BlitzMax Beginners Area/OpenURL and anchors| 
 | ||
| I'm trying to open an HTML file with OpenURL, which works good. But now I want the HTML file to jump to a certain anchor, using the hash character. For instance this: OpenURL("data\helpfile.html#tutorial") It opens the html file, but the part from the hash character is missing. I've tried using Driver.OpenURL directly, but with no success. Is there something else I could try ? Edit: I found this for a workaround: It works, but I would still like to know what causes this problem, and if there is a better way to deal with it. | 
| 
 | ||
| It seems on Windows, ShellExecuteA() strips anything after # in file urls... strangly enough, it allows # in http urls ;) I found an alternate way of doing it, but there is probably a better way: 
Function OpenURL( url:String )
	Local dev:String,anchor:String
	dev=url[..5].toLower()
	If dev<>"http:" And dev<>"file:"
		Local h:Int=url.find("#")
		If h>-1
			anchor=url[h..]
			url=url[..h]
		EndIf
		Local f:String=RealPath(url)
		If FileType(f)
			url="file:"+f +anchor
		Else
			url="http:"+url+anchor
		EndIf
?Win32		
		Extern "Win32"
			Function ShellExecuteW:Int( hwnd:Int, op$w, file$w, params$w, dir$w, showdmd:Int)
		EndExtern		
		Local params:String = "url.dll,FileProtocolHandler ~q" + url + "~q"
		ShellExecuteW( 0, "open", "rundll32.exe", params,Null, SW_SHOWNORMAL)
?
	EndIf
EndFunction
 | 
| 
 | ||
| Ah, cool, it works on my PC. Yesterday, I tried using OpenURL on my Mac (ppc), but it didn't do anything. I used the system_ command instead, and it openend up an html file, but I didn't tried it with anchors yet. Thanks, grable |