Skip to content

Instantly share code, notes, and snippets.

@dodikk
Last active Dec 15, 2015
Embed
What would you like to do?
Javascript injection stopped working in iOS 6.1
function createScriptElementWithWebPlugins() {
var headID = document.getElementsByTagName("HEAD")[0];
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.onload=function(){
//scmobile.device.name = 'Igor's iPhone'; // JS interpreter error
scmobile.device.name = unescape( 'Igor%27s%20iPhone' );
alert( scmobile.device.name ); // Shows |Igor's iPhone|
scmobile.device.uuid = 'XXXXXXXXX';
scmobile.device.version = '6.1.2';
scmobile.device.socketPort = 'XXXXX';
scmobile.device.__fireDeviceReady();
};
newScript.src = 'scmobile://localhost:33445/var/mobile/Applications/37A95597-C552-4EE3-A297-47C044E17AC7/Documents/scmobile_main.js';
return headID.appendChild(newScript);
}
createScriptElementWithWebPlugins();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment