2

I am at a lost why this works in Chrome but not IE. This is a link within a web part for SP 2010.

<a href="javascript:ExecuteOrDelayUntilScriptLoaded(SP.UI.ModalDialog.OpenPopUpPage('/_layouts/FormWebPart/print.aspx?id=877',null,400,900), 'SP.js');" target="_blank">Print</a>

I tried it with and without the extra ExecuteOrDelayUntilScriptLoaded and in all cases it works in Chrome but not in IE. In IE, it complaints that SP was undefined. However, SP is added at the bottom the page.

I am not really sure what Chrome does differently that it can execute this perfectly while IE just bombs out. The sad part is that SP is a Microsoft platform, you would think it would be the other way around.

  • It seems Chrome has some how cached a previous SP.js file. Try clearing chrome cache and it will also throws the same error. Which IE version you are using? – Amal Hashim Oct 24 '14 at 18:20
  • @AmalHashim Cleared Chrome's history on w7 and w2012 servers and it works just fine, while in IE; it can't seem to find sp object??? – wirble Oct 24 '14 at 20:18
  • Did some more testing, I don't think it has anything to do with the SP having loaded yet. It's as if IE doesn't recognize the "javascript" in the <a> tag. The who javascript:xxxxx are in the address bar as if it's loading everything in href – wirble Oct 25 '14 at 1:09
1

You could try this approach using onclick event:

<a onclick="ExecuteOrDelayUntilScriptLoaded(SP.UI.ModalDialog.OpenPopUpPage('/_layouts/FormWebPart/print.aspx?id=877',null,400,900), 'SP.js');" href="javascript:void(0);">Print</a>
  • 1
    yes that's what i ended up doing but i still want to know why the other method didn't work. oh well as long as something works...thanks – wirble Oct 27 '14 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.