adampresley / sublime-view-in-browser

Open the contents of your current view/tab in a web browser
MIT License
271 stars 68 forks source link

Open in web server doesn't work for me (Windows 7/x64/Chrome) #11

Closed jmartinsen closed 11 years ago

jmartinsen commented 11 years ago

After setting the project settings the browser still uses the file:// protocol

I've setup my apache server to listen to http://work/ with a document root of C:\work. So when I want to run this file:

C:\work\my-client\web\my-client.com\index.php

the URL would be:

http://work/my-client/web/my-client.com/index.php

So please help my figure out what is wrong with my settings? It opens in correct browser, but with the file:// instead of defined http://.

OS: Windows 7 (x64) Browser: Chrome (x32)

sublime-project file:

{
    "folders":
    [
        {
            "path": "/C/work/my-client/web/my-client.com"
        }
    ],

    "settings": {
        "sublime-view-in-browser": {
            "baseUrl": "http://work/",
            "basePath": "my-client/web/my-client.com"
        }
    }

}
adampresley commented 11 years ago

I will take a look at this as soon as I can and let you know what I find.

On Fri, Mar 1, 2013 at 9:31 AM, jmartinsen notifications@github.com wrote:

After setting the project settings the browser still uses the _file://_protocol

I've setup my apache server to listen to http://work/ with a document root of C:\work. So when I want to run this file:

C:\work\my-client\web\my-client.com\index.php

the URL would be:

http://work/my-client/web/my-client.com/index.php

So please help my figure out what is wrong with my settings? It opens in correct browser, but with the file:// instead of defined http://.

OS: Windows 7 (x64) Browser: Chrome (x32)

sublime-project file:

{ "folders": [ { "path": "/C/work/my-client/web/my-client.com" } ],

"settings": {
    "sublime-view-in-browser": {
        "baseUrl": "http://work/",
        "basePath": "my-client/web/my-client.com"
    }
}

}

— Reply to this email directly or view it on GitHubhttps://github.com/adampresley/sublime-view-in-browser/issues/11 .

Adam Presley, Senior Software Engineer Visit http://www.adampresley.com Email: adam@adampresley.com

Twitter: http://twitter.com/adampresley

adampresley commented 11 years ago

Ok, I did a quick local test on my Win7 + Chrome laptop and would like you to try this:

{ "folders": [ { "path": "/C/work/my-client/web/my-client.com" } ],

"settings": {
    "sublime-view-in-browser": {
        "baseUrl": "http://work",
        "basePath": "C:\\work\\my-client\\web\\my-client.com"
    }
}

}

The change to baseUrl is to remove the trailing slash, and basePath to match the project path. Essentially that basePath part gets replaced with what is in baseURL.

Give it a try and let me know what happens. Cheers!

On Fri, Mar 1, 2013 at 9:31 AM, jmartinsen notifications@github.com wrote:

After setting the project settings the browser still uses the _file://_protocol

I've setup my apache server to listen to http://work/ with a document root of C:\work. So when I want to run this file:

C:\work\my-client\web\my-client.com\index.php

the URL would be:

http://work/my-client/web/my-client.com/index.php

So please help my figure out what is wrong with my settings? It opens in correct browser, but with the file:// instead of defined http://.

OS: Windows 7 (x64) Browser: Chrome (x32)

sublime-project file:

{ "folders": [ { "path": "/C/work/my-client/web/my-client.com" } ],

"settings": {
    "sublime-view-in-browser": {
        "baseUrl": "http://work/",
        "basePath": "my-client/web/my-client.com"
    }
}

}

— Reply to this email directly or view it on GitHubhttps://github.com/adampresley/sublime-view-in-browser/issues/11 .

Adam Presley, Senior Software Engineer Visit http://www.adampresley.com Email: adam@adampresley.com

Twitter: http://twitter.com/adampresley

jmartinsen commented 11 years ago

Wow. Fast response. That's what I call awesome support. Thanks

The following seem to work:

"baseUrl": "http://work/enok-total/web/enoktotal.no",
"basePath": "C:\\work\\enok-total\\web\\enoktotal.no"

What is the function of the basePath variable?

What if I want to always open up the same URL (e.g. http://work/enok-total/web/enoktotal.no), no matter which file I'm on. Can it be done?

adampresley commented 11 years ago

The basePath tells the plugin where the root folder of your project files are. So when you execute the plugin with a basePath of C:\work\enok-total\web_, and your current file is at C:\work\enok-total\web\test.html, the will replace the root portion of that path with what is defined in baseUrl_. So the final result will be http://work/enok-total/web/test.html .

In short the plugin does not open the same file/url every time.

On Fri, Mar 1, 2013 at 11:26 AM, jmartinsen notifications@github.comwrote:

Wow. Fast response. That's what I call awesome support. Thanks

The following seem to work:

"baseUrl": "http://work/enok-total/web/enoktotal.no", "basePath": "C:\work\enok-total\web\enoktotal.no"

What is the function of the basePath variable?

What if I want to always open up the same URL (e.g. http://work/enok-total/web/enoktotal.no), no matter which file I'm on. Can it be done?

— Reply to this email directly or view it on GitHubhttps://github.com/adampresley/sublime-view-in-browser/issues/11#issuecomment-14300712 .

Adam Presley, Senior Software Engineer Visit http://www.adampresley.com Email: adam@adampresley.com

Twitter: http://twitter.com/adampresley

adampresley commented 11 years ago

Closing this issue cause I think it is all worked out.