• 0

re-direct if IE detected


Question

14 answers to this question

Recommended Posts

  • 0

I've heard that it's not always reliable to check the user's browser from PHP, but I admit I haven't researched it much. You're probably fine doing it this way since the cases where it doesn't work is likely someone doing something they shouldn't be doing.

  • 0
I've heard that it's not always reliable to check the user's browser from PHP, but I admit I haven't researched it much. You're probably fine doing it this way since the cases where it doesn't work is likely someone doing something they shouldn't be doing.

It's actually very unreliable. In fact, there's not a single way you could discriminate between different browsers by relying solely on some variable supplied by a browser, because they could all be changed with relative ease. The only sure way is to put a hack together that exploits the varying degree of technological sophistication amongst the different rendering engines, and make them filter themselves (if the browser doesn't support a certain technology, editing the UA won't change a damn thing). Suffice it to say, not very pretty and often not possible anyways. Only under very limited circumstances could you effectively tell what browser is what, so there's basically no point in trying to discriminate amongst them. The effort would be much better spent making the website just work with every browser.

  • 0

bad idea, just make it work in every browser :)

but if you really want to do this there is a better way

<!--[if lte IE 6]>

<script type="text/javascript">

window.location = "blabla";

</script>

<![endif]-->

will let you redirect ie6. I don't see any reason to redirect ie7 because a lot of the hacks aren't necessary anymore and making a site work in ff, opera and ie7 isn't really that difficult

  • 0
bad idea, just make it work in every browser :)

but if you really want to do this there is a better way

<!--[if lte IE 6]>

<script type="text/javascript">

window.location = "blabla";

</script>

<![endif]-->

will let you redirect ie6. I don't see any reason to redirect ie7 because a lot of the hacks aren't necessary anymore and making a site work in ff, opera and ie7 isn't really that difficult

IE7 has some rather....shall we say, interesting, rendering bugs that I don't believe occured in IE6.

In any case, why not just use if lt IE7? (1 less character!), and the javascript redirect won't work for everyone. Same problem with meta redirects as well.

  • 0
In fact, there's not a single way you could discriminate between different browsers by relying solely on some variable supplied by a browser, because they could all be changed with relative ease...

Only under very limited circumstances could you effectively tell what browser is what, so there's basically no point in trying to discriminate amongst them. The effort would be much better spent making the website just work with every browser.

Until Microsoft get their act together and properly deal with the XHTML1.1 content type (and by which time you shouldn't / won't want to redirect) you can check $_SERVER['HTTP_ACCEPT'] / Request.ServerVariables("HTTP_ACCEPT") for "application/xhtml+xml". Opera says it can handle it, as does the fox, Safari does the IE trick of allegedly supporting everything ("*/*"), unless that's changed recently. Whilst UA is easy peasy (even for IE) to change, the Accept shouldn't be able to be altered.

  • 0
Until Microsoft get their act together and properly deal with the XHTML1.1 content type (and by which time you shouldn't / won't want to redirect) you can check $_SERVER['HTTP_ACCEPT'] / Request.ServerVariables("HTTP_ACCEPT") for "application/xhtml+xml". Opera says it can handle it, as does the fox, Safari does the IE trick of allegedly supporting everything ("*/*"), unless that's changed recently. Whilst UA is easy peasy (even for IE) to change, the Accept shouldn't be able to be altered.

it's possible, why anyone would ever want to change it is beyond me. but as you said, using http_accept will give you problems with safari (which is more correct than IE in claiming */*).

  • 0

I used to check to see if it contained "MSIE", but didn't contain Opera (because Opera used to identify as IE)

And don't check for Safari, check for WebKit, otherwise you'll break other mac browsers (and some are really fun, they use WebKit but override XHTML rendering and treat it as RSS!)

:sleep:

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Sony announces Bungie layoffs that will affect "significant number of employees" by Pulasthi Ariyasinghe Sony today announced that major layoffs are happening at its first-party studio Bungie, the developer that has spawned series like Halo, Destiny, and Marathon over the past decades. The news arrives just weeks after Bungie delivered the final update to Destiny 2, and it's that team being hit with the layoffs the most. CEO of Sony Interactive Entertainment Hermen Hulst revealed the staff reduction today, calling it "painful news." "Over the past several months, together with Bungie leadership, we reviewed the studio’s long-term direction, development priorities, resource needs, and role within our broader portfolio strategy," said Hulst, explaining the decision. "We explored multiple alternatives before concluding that a reduction was necessary to align the studio’s resources with its current priorities and long-term goals." The layoffs will be hitting "a significant number of employees" across most of the Destiny franchise development team. It doesn't look like Sony is planning to continue the series following Destiny 2's sunsetting update. The studio is said to be in early stages of looking at other projects to pivot to, but it's said that keeping the size of the team at current levels is no longer feasible. "We know this decision has a profound impact on the people affected, their families, friends, and teammates," said Bungie leadership in a separate message on social media. "While these changes are necessary to best position the studio now and for the future, that does not lessen the difficulty of this moment or the impact it has on those affected." At the same time, "some" of the Marathon development team are also affected by the layoffs. The recently released multiplayer-only extraction shooter title hasn't seen a big boom of players either, but the company is reportedly hoping that the live service experience will pick up players with future updates.
    • Microsoft adds reusable skills and finance data connectors to Copilot in Excel by Karthik Mudaliar Microsoft is giving Copilot in Excel a collection of new features aimed squarely at finance teams. The update introduces reusable instructions for common tasks, connections to services such as FactSet and Morningstar, and a better way to review what Copilot intends to do before it starts changing a workbook. The most interesting addition is 'Skills' finally coming to Copilot in Excel. Skills let companies teach Copilot how to handle a recurring process, so employees do not need to write the same detailed prompt every month. Users can create skills that can specify the steps Copilot should follow, along with the required layout, formulas, and formatting. Microsoft says users can create their own skills by saving a SKILL.md file in OneDrive. The file is written using Markdown and tells Copilot when and how to perform the task. Once it is available, a user can select the skill in the Copilot pane or mention it in a prompt using the @ symbol. There is also a library of prebuilt finance skills for customers who do not want to create their own. Microsoft plans to let developers distribute additional skills through the Microsoft Marketplace and the Microsoft 365 Admin Center, with LSEG, Ramp, Rogo, samaya.ai, Velixo, and Vena among the first partners involved. The company says that it is also expanding the external data that Copilot can access from inside Excel. New connectors are being added for CB Insights, Daloopa, FactSet, Morningstar, PitchBook, and S&P Global data through technology developed by Kensho. There is a catch, however. Accessing these services may require a separate subscription from the relevant data provider, so a Microsoft 365 Copilot licence will not necessarily unlock all of them. FactSet is also only available in preview for now, with general availability planned for July. Microsoft is also trying to make Copilot’s workbook edits easier to inspect. Users can switch to a planning mode that shows which sheets, cell ranges, formulas, and assumptions Copilot intends to work with before it begins making changes. Once the work is complete, the Show Changes pane can distinguish edits made by Copilot from those made by human collaborators. The update continues Microsoft’s push to turn Excel Copilot from a chatbot into an agent that can carry out longer tasks. The company previously added an Agent Mode capable of planning and completing multi-step Excel work. Microsoft also recently acquired financial AI startup Fintool, another indication that finance is becoming a key target for its Excel AI strategy. Prebuilt skills, personalization, workbook rules, external connectors, planning mode, and Copilot attribution in Show Changes are generally available to Microsoft 365 Copilot customers using Excel on the web, Windows, and macOS. Custom skills are initially available to Microsoft 365 Insiders on Windows and Mac starting today. Microsoft plans to make them generally available across Windows, Mac, and the web over the next month. Partner-built skills are expected during the third quarter of the year. Availability may still differ depending on region and licensing.
    • Exactly. They serve different (although related) purposes.
    • Do not enter the code under any circumstances, or you will be sorry. It's definitely and most likely a hacking attempt.  That happened to me a couple of years ago, and I kept receiving those prompts for months. It's simply the attacker trying to get you tired of the constant requests, so you just give up and enter the code, so they can log in to your account. 
  • Recent Achievements

    • First Post
      kinowa earned a badge
      First Post
    • Rookie
      krychek57 went up a rank
      Rookie
    • Grand Master
      Jaybonaut went up a rank
      Grand Master
    • One Year In
      Philsl earned a badge
      One Year In
    • Dedicated
      Scoobystu earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      438
    2. 2
      +Edouard
      169
    3. 3
      PsYcHoKiLLa
      134
    4. 4
      Xenon
      77
    5. 5
      Michael Scrip
      75
  • Tell a friend

    Love Neowin? Tell a friend!