Reputation: 53
We have a legacy solution that is based on running a huge (6000+lines) Javascript code. It's started by executing a small Javascript code as a bookmarklet in Firefox (a bookmark containing a code instead of an URL). The initial code downloads the main script from a web server and initiates its execution. It's important that the certain web page should be opened at that moment in the web browser, otherwise the main script won't work.
Currently, we're using the below code in the bookmarklet:
javascript:(
function(){
if(window.location.href.indexOf('BaseURL')==-1){
if(confirm("You are not on the web page - go to it?")==true){
window.location.href=' BaseURL ';
}
}
else{
jQuery.getScript("ScriptURL");
}
}
)()
The drawback is, users should click OK each time they start the app and then click the same bookmark again. I'm trying to simplify the process by immediately opening the web page. However, the below code doesn't work. The BaseURL is opened, but the script is not executed:
javascript:(
function(){
window.location.href='BaseURL';
jQuery.getScript("ScriptURL");
}
)()
When checking the debugger in Firefox, I see that there is a request to retrieve the script from the ScriptURL, but it's completely empty, and the web site doesn't return anything. Seems the getScript command is not executed correctly.
I'm not a Javascript / webdev specialist. I have a programmer background in different scripting languages, but I don't know almost anything about Javascript. My apologies if I ask a trivial question, but my attempts to search for a solution on my own have failed.
Upvotes: 0
Views: 49