0

I am using a jquery plugin, that has problems on Internet Explorer. The plugin works, but only when the page has been refreshed.

I want to use Javascript to refresh the page on load, but I only want the script to run IE and not in any other browsers.

There is a script here, which can be used to make the page refresh on load. However, the script is for all browsers. How can I limit it to just Internet Explorer?

Also, on the example page, the script is run directly from the HTML page. Is there away I can link to it (e.g. so I can serve the script in a separate .js file)

Community
  • 1
  • 1
big_smile
  • 1,487
  • 4
  • 26
  • 59
  • 3
    You do not want to reload the page to make a plugin work in IE - you want to fix your page so it works in IE without the reload. Why do you not show us the page and perhaps we can fix it without the reload? – mplungjan Feb 16 '12 at 10:09

2 Answers2

1

As I said in my comment

You do not want to reload the page to make a plugin work in IE - you want to fix your page so it works in IE without the reload. Why do you not show us the page and perhaps we can fix it without the reload?

If you insist do this

<!--[if IE]>
<script>
window.onload=function() {
  if (location.href.indexOf('again')==-1) location.replace(location.href+'?again');
}
</script>
<![endif]-->
mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • Here is the site: http://www.firstchoicelegal.co.uk/ I am using the plugin CJ Flashy Slideshow version 1.13 (http://www.cjboco.com/projects.cfm/project/cj-flashy-slide-show/1.1.3) The plugin works fine under all browsers except for IE, where you have to reload the page to make it work. – big_smile Feb 16 '12 at 11:25
  • Actually, this is really a separate question, so I have posted it separately: http://stackoverflow.com/questions/9311202/cj-flashy-slideshow-requires-page-reload-to-work-with-internet-explorer – big_smile Feb 16 '12 at 12:23
  • How does this show? I load your site in IE8 and I see a slideshow – mplungjan Feb 16 '12 at 13:35
0

sometimes mplungjan's answer is the best way,
sometimes the best way is:

if (navigator.appName=="Microsoft Internet Explorer")
{ // your code
} else { // your code
Dani-Br
  • 2,289
  • 5
  • 25
  • 32