Local website renders differently using (IP address or machine name) vs localhost?
The same css file is used for every page, and F12 in IE8 shows the
correct css has been loaded.
Developer Tools should show that IE is not using the same "Browser Mode"/"Document Mode" between the two instances of the site, because that's the problem here. IE defaults to different modes depending on if you're using a machine name or not (amongst other things).
Adding this to your <head>
should sort out the problem:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
window.sessionStorage issue in IE, when webpage is not run on localhost
I found my answer on: Local website renders differently using (IP address or machine name) vs localhost?
Turns out, that the issue was with my html, not my javascript. I added this line in my head tag:
<meta http-equiv="X-UA-Compatible" content="IE=11">
and that fixed it.
Viewing localhost website from mobile device
To view localhost website from mobile device you have to follow thoses steps :
- In your computer, you have to retrieve your IP address (Run > cmd > ipconfig)
- If your localhost use a specific port (like localhost:12345 ), you have to open the port on your computer (Control Panel > System and Security > Firewall > Advanced settings and add Inbound rule)
- Finally, you can access to your website from mobile device by navigate to : http://192.168.X.X:12345/
Hope it helps
Browse Web Site With IP Address Rather than localhost
Go to your IISExpress>Config
folder, locate applicationhost.config
. Change <bindings>
as below:
<bindings>
<binding protocol="http" bindingInformation="*:1407:YOUR_IP_ADDRESS" />
</bindings>
Before you do this , you will have to register this IP address using netsh
command as below:
Port forwarding in Windows 7
If you’re running Windows 7, pretty much all incoming connections are locked down, so you need to specifically allow incoming connections to your application. First, start an administrative command prompt. Second, run these commands, replacing 192.168.1.11:1234 with whatever IP and port you are using:
> netsh http add urlacl url=http://192.168.1.11:1234/ user=everyone
This just tells http.sys
that it’s ok to talk to this url.
IMPORTANT: The user=everyone parameter must be specified according to the system language. So if your windows language is spanish the parameter must be user=todos.
> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=1234 profile=private remoteip=localsubnet action=allow
This adds a rule in the Windows Firewall, allowing incoming connections to port 58938 for computers on your local subnet.More information at this link.
Port forwarding Mac OS X
Step 1: View Current Firewall Rules
sudo ipfw show
Step 2: Add Port Forwarding Rule (80 to 8080)
The default port that Tomcat runs on is 8080, so here we show the command to do port fowarding from port 80 to 8080 (Tomcat’s default port). Obviously, this works for other ports as well, and you’d just have to adjust the command accordingly.
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in
This is a temporary change, and it will revert once you reboot. If you want to make it permanent, you can create a lauch deamon for it.
Optional Remove Rule
If you want to remove your firewall rules run:
sudo ipfw flush
Port Forwarding Using PFCTL (aka PF) on Mac OS X
The setup for pfctl
is similar to ipfw
. Github user kujon has created a nice guide to show how to set up port forwarding from port 80 to another port using pfctl
.
Note: Be sure to change the bindings of your project only by locating its name. You can even keep the localhost binding and add a new one , this way you can access same webpage using both the given IP address and your old localhost binding.
Viewing of web page from local host and using IP address
In IE 8 Microsoft introduced different rendering modes for local and Internet servers so that web developers would break down in tears. By accessing via a different IP address you are causing the server to be treated as being in a different zone.
If there’s no X-UA-Compatible value and site is in
Local Intranet security zone, it will be rendered
in EmulateIE7 mode by default.
Add X-UA-Compatible header or META to force full IE8 (or newer) standards mode.
See also http://sharovatov.wordpress.com/2009/05/18/ie8-rendering-modes-theory-and-practice/
Related Topics
How to Make Half-Square Background in CSS
How to Set Horizontal Gradient to Text via CSS? (Left Letter One Colour, Right - Another Colour)
Should I Use More Than One CSS Sheet
::After on :Hover Does Not Work in Ie
Ie Background Size Not Working
How to Detect Element Visibility Using Only CSS
Rtl Is on Web Page Reverses Numbers with a Dash
CSS Regex Selector Match One or Another Condition
Rendering Font Differs from Ie Compared to Ff and Chrome
Clicking a Child Doesn't Trigger the Parent's :Active State in Ie
Center Align Position Absolute Object Horizontally
Mobile Orientation Change Not Applying CSS
How to Apply Clippath to a Div with the Clippath Position Being Relative to the Div Position
How Do CSS Sprites Speed Up a Web Site
How to Remove Clear Button ( 'X' Button ) from Ie10 Textboxes in Compatibility Mode