Safari 5.0 Extension Scripts Won't Run on Local Files - javascript

I wrote a very simple extension for Safari 5 that only outputs a single log message from a start script. This is the start script:
console.log('start script running');
If I go to any internet page (eg. http://www.yahoo.com) the log message appears in the error console. But if I open any local html page no log message appears. By local I mean on my local machine. It's like my start script never gets run for local pages (eg. C:/blank.html).
Is there a permission setting I'm overlooking or is this a feature of Safari 5?
Brent

Caveat: I only have a passing familiarity with the Safari extension system. I work on Google Chrome which is based on Webkit. Safari is also based on webkit.
In a Google Chrome extension, you can inject a script into a local page using the file:// permission. But I’m pretty sure there’s no analogue for Safari extensions.
The Safari page on script injection also seems to say you can’t interact with local files:
“You cannot access resources on the user’s hard drive outside of the extensions folder.”

There is no way to inject scripts on local files.
If you feel like it, you may complain at bugreport.apple.com.

Related

Website without XMLHTTPREQUEST without webserver

For school we have to make a site.
That site has to run from a local file by opening the index.html.
I am using:
<script type="text/javascript">
$("#navbar").load("SideBar.html");
</script>
To get a sidebar.
The problem is that I get the XMLHTTPREQUEST error on Chrome, on safari it works perfectly.
The teacher does not allow to use a webserver.
What can I do so that my teacher is able to run my site without a webserver?
This is due to chrome security policies. If you don't disable it you won't be able to load local file.
You can disable it by running chrome with the following command on windows.
chrome.exe --allow-file-access-from-files
There's a bit more information here.

safari loads css/js very slow on client certificate SSL website

I have a website where I use client certificates for accessing the site and it runs with SSL required. It runs on IIS 8.5 on a windows server 2012 R2.
All my css and javascript is minified into 4 seperate files
app.js -> Our own javascript
app.css -> Our own css
vendor.js -> External javascript libraries
vendor.css -> External css libraries
All of these files are minified and placed locally on the server.
The site works very well when using chrome or IE from a computer, but when using safari (only tried safari 5 on PC and latest safari on iphone 6/7) the page can stuck in a "loading" mode. The does not happend every time, and when it does it often helps with clearing the cache in safari and try again.
The website also uses local storage to save some userdata, and a cookie that stores a token for authentication. Not sure if this is useful information, just throwing it out there.
It can connect to the webserver, since we can see the EV+ certificate.
When debugging the phone on a mac, or safari on a PC and looking at the network tab in the developer window I can see that sometimes it takes really long time for the browser to load some of the css and/or javascript files.
Sometimes it appears to be vendor.js, and sometimes app.css, and sometimes the other ones. There seems to be no logic to me, that its always the same files etc.
The site is .NET 4.6 site, running with angularjs, signalr 2.2.1 and html5 in the front.
We have tried
Monotoring IIS Logs and network traffic
Remove sourcemap on css/js to reduce file size
Tried reference signalr/hubs (the generated js file). And also tried copying the content into vendor.js so there is a local version instead
Without any success ATM. I would really appreciate help, feeling stuck on this one.
Many Thanks!
It may be dynamic compression. Are you using Brotli compression on the server?
I suggest a detailed analysis of HTTP Request and Response headers. There may be a discrepancy resulting in this unexpected behaviour. I would follow this up with scouring the Safari bug tracker.
The SSL certificate itself may be the issue, or rather Safari's interpretation of policies.
Hope it helps.

automation server can't create object on IE10

I have a web page from which i am creating activeX object and calling some methods in it.I have created msi file to register actveX dll. It works fine on my local machine but when i try it on other machines,it does not work. I have also installed the msi file on other machines and enabled "Initialize and script ActiveX Controls not marked as safe for scripting" in IE but still it does not work on other machines.
What is going wrong?
Thanks
Check after you run the .msi that your ActiveX.dll is registered properly. You should see it in IE 10 under I believe "Tools" (gear icon) - "Manage Add-ons". It should be listed there, make sure you set the Show dropdown list to "All add-ons". If you don't see your ActiveX listed there, something went wrong with registering the ActiveX.
You'll want to troubleshoot your .msi at that point, run it with verbose logging turned on.
msiexec /i MyActiveXInstaller.msi /l*vx "C:\Somepath\ErrorLog.log"

How do I keep a constant websocket connect in the background of firefox addon

I am currently try to migrate a chrome extension to firefox
I try to read the starter guide but find nothing like background.js in chrome
do I simply connect and maintain the socket in main.js? what is the life cycle of main.js, when will it be called can when will it be destroyed
Your main.js and other modules (under lib/) are indeed similar to background.js of chrome extensions.
main.js will be run when the add-on is started (after installation, or when the browser is started) and stays around until the add-on is shutdown (browser shutdown, user disables or uninstalls the add-on).
However, main.js does not have access to the HTML5 (DOM) APIs, as there is no underlying web-page. The easiest way to solve this is using page-worker with a local (data/) html page which does the actual websocket connection and use regular message passing between the worker and main.js or whatever other modules and/or content scripts you got.

How to sign script or webpage requiring UniversalXPConnect privilege

I have a website which uses some functionality implemented in the Firefox extension, which I developed. JavaScript script on one of my webpages requires UniversalXPConnect privilege for communicating with XPCOM component implemented in my Firefox extension.
By default, when my script tries to enable this privilege for accessing XPCOM component:
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
... the following error occurs:
Error: A script from "http://example.com" was denied UniversalXPConnect privileges.
To enable this privilege currently users need to manually edit "signed.applets.codebase_principal_support" setting in "about:config" Firefox page.
From this page: http://www.mozilla.org/projects/security/components/signed-scripts.html I learned that it is possible to explicitly sign my webpage containing script which requires this privilege. After I sign my script users will not need to manually edit above mentioned setting.
Website is hosted on Linux platform under Drupal CMS.
I would very much appreciate if you could give me detailed step-by-step instructions on how do I sign my script (what tools should I download, how to create certificate, etc.), such that after following your instructions editing about:config setting will not be necessary.
As of Firefox 16 signing the script will not likely work since support for universalXPconnect seems to have been removed and you should now use an add-on for added privileges although I don't know how. https://bugzilla.mozilla.org/show_bug.cgi?id=546848
EnablePrivilege is disabled in Firefox 15 and will be removed in Firefox 17.
check out this:
https://developer.mozilla.org/en-US/docs/Bypassing_Security_Restrictions_and_Signing_Code

Categories