开发者

open html page on my hardrive - sinatra project

In my erb file, this works as expected:

<INPUT  type="button" target="_blank" value="Preview" name="button0" onclick="window.open('htt开发者_StackOverflowp://google.com');" >

however I need to open an html page on my hardrive. This works, if I put the file in my static directory:

<INPUT  type="button" target="_blank" value="Preview" name="button0" onclick="window.open('test.html');" >

I had made /static available with this code from the main.ru page:

set :public, File.dirname(__FILE__) + '/static' 

but i need to open up an html page from a path that's like ../../../blah/blah/blah/test.html, and nothing seems to work. Is there a way to do that? Thanks.


You should try to provide the whole path like

<INPUT  type="button" target="_blank" value="Preview" name="button0" onclick="window.open('YourDriveLetter://YourFolder/static/test.html');" >

for just a example....

<INPUT  type="button" target="_blank" value="Preview" name="button0" onclick="window.open('C:\mysite\static\blah\blah\blah\...\test.html');" >

and for include one...

set :public, File.dirname(__FILE__) + 'C:\mysite\static\'

hope it worked!

Good Luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜