开发者

if ($.browser.msie) then add Jquery include function

开发者 https://www.devze.com 2023-01-05 08:59 出处:网络
Hello, I have page for which I want to load different .tpl for different browsers. I found th开发者_运维知识库is code to include external files using Jquery.

Hello,

I have page for which I want to load different .tpl for different browsers.

I found th开发者_运维知识库is code to include external files using Jquery.

$.getScript("1.js",function() {
            //this script is loaded
});

I want to make above code conditional based on browsers for Example

if($.browser.msie)

$.getScript("1.tpl",function() {  
//this includes external file - 1.tpl

}else{

$.getScript("2.tpl",function() {   
//for other browser includes external file - 2.tpl

I am not javascript coder ... Can anyboby make this work ?

Thanks,

  • Mandar


I think you are looking for load method.


Looks like you had some syntax errors with your curly brackets, etc.

Try this:

if($.browser.msie)
{
    $.getScript("1.tpl",function() {  
        //this includes external file - 1.tpl
    })
}
else
{
    $.getScript("2.tpl",function() {   
    //for other browser includes external file - 2.tpl
    })
}

I should add that I have no idea what a .tpl is so all I did was corrected the syntax of your javascript. You may need to change the actual funciton calls as metnioend by others here.

0

精彩评论

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