简体   繁体   中英

Page url is different in IE and Firefox

I have this wired situation using JQuery. I have three pages on my website.

  1. index.html
  2. business.html
  3. operation.htmls

When i open business.html URL is firefox , it opens like this

http://localhost:9090/Operational/business.html

When i click an button on this page called 'operation.html', it open a new page with follow address

http://localhost:9090/Operational/operation.html

All fine till now. But when I open the same operation.html page in IE 9, the URL is something unusal :

http://localhost:9090/Operational/business.html#/Operational/Operations.html

Why is this so? Can somebody put some light on this? I am stuck :P @!!!!

adding more details

I am using a development tool called tiggzi. here is the anchoring part of the code.

$('#j_2 [name="mobilenavbaritem4_141"]').die().live({
    click: function () {
        if (!$(this).attr('disabled')) {
            Tiggr.navigateTo('Operations', {
                transition: 'slide',
                reverse: false
            });
        }
    }
});

Without seeing the code, we can only speculate, but it is very likely that the page has JavaScript which updates the content and then uses the history API to set a bookmarkable URI.

IE9 doesn't support the history API, so it falls back to using a fragment identifier as a hack.

If someone were to visit http://localhost:9090/Operational/business.html#/Operational/Operations.html directly, the server would deliver the content of business.html and then the JavaScript would request the content of Operations.html and replace it.

Thats because you probably have onclick on an Anchor tag as well as working href .

If thats the case, put return false; at within the end of the onclick.

I have found the problem and the solution.

I was using a custom jquery mobile library by tiggzi called tiggr. This was causing the error in IE.

The code was this

Tiggr.navigateTo('Operations', { transition: 'slide', reverse: false })

Now i have replaced the same with

window.open('Operations.html', '_self', 'width=600,height=400,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')

i know this tweak with have problem during the transition, but I can move on with that.!

Thanks everyone for helping!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM