What’s the difference between <a href="url"> and window.location = "url" on iOS? What’s the difference between <a href="url"> and window.location = "url" on iOS? ios ios

What’s the difference between <a href="url"> and window.location = "url" on iOS?


Try window.open, passing in "_self" as the target window name.

window.open(there, "_self");

Using "_self" is the critical part here, otherwise the popup blocker would intercept it. I'd test this, but I don't have a link to an acsm file.

Edit: Two more ideas:

Add a form to your page with a method of "GET" and an action of your acsm file. Exclude form fields unless they map appropriately to your URL.

<form id="acsm" method="GET" action="http://myserver.com/myfile.acsm"></form>

Then just submit your form with form.submit():

document.forms.acsm.submit();

And the other idea: Create a page on your server that does a server-side redirect to your acsm file. Then just use the usual location.href = url to that server page.


create a new a tag and click it using jquery:

$("<a />").attr("href", there).click();

the a tag in this case will not be added to DOM, will only be used to simulate the click.


It seems like a Safari bug to me.If you write window.location : Safari is expecting an html file or any type of file it can actualy display.

Whereas when you click a link it reads the content-type and then decide to open it in the same window or open an application for it.

I think you should try to open a popup window with the url. It should theoretically work.