why plugin blocked by Safari? - javascript

My plugin almost works fine in Safari for Mac, but sometimes it is blocked by Safari(see at Safari - Preferences - Security - Manage website setttings).
so my first question is how can I let my plugin be a "Allow Always" plugin in Safari without user's operation?
And when plugin is blocked, Safari will display a placeholder instead of the Internet plugin content. look here
so the second question is when Safari block my plugin(maybe user choosed), how to know it by JS?

Your comments above made it more clear what you were trying to accomplish. It has already been established that if your plugin is blocked than no code inside your plugin will be executed (for security reasons) but it is possible to let your website know if the plugin was loaded (or not loaded) using injected scripts. Here is an example on the Apple developer page showing how an injected script can access a JavaScript function.
In this document you will find everything you need to know about access and restrictions for your plugins and extensions
And this document will help you understand messaging and proxying between different components of your plugin and the website.

Related

Is it possible to bypass popup blocking on Safari latest (currently: 10.1.2) when using window.open?

Based on some very useful replies here (like this), I built some code to deal with popup blocking that works fine on other browsers (like Chrome), but not on Safari - loader and target page are just samples, they will be internal documents in the production version:
//redirecting user to a temporary page displaying some loader
test=window.open('https://codepen.io/jackrugile/full/ejsbf/', '_blank');
//setTimeout to simulate some API call
setTimeout(function() {
//this part does not work on Safari to change the new page to target page
test.location.replace('http://google.com');
}, 3000)
I am well aware that popup are evil, they are blocked for a reason and more, but consider I am developing a tool to be accessed and used exclusively inside a given corporate environment, the popup is in the requirements of the company itself and no, we are discussing about too many devices and people with too little technical prowess to think about just disabling the blockers for our own app.
Any tip to make it work on Safari, provided it is possible at all? I might consider dropping the window.open() part, but we need to have a reliable check to verify whether the document was successfully opened or not.

how i can determine that code or elements are blocked by not-IE browsers?

i have self-hosted ASP.NET web service and small HTML5 application that communicates with that service
when i try open this page in IE, browser show me notification that it has blocked ActiveX components and scripts. allowing browser to execute dynamic components, HTML/JS code working fine - queries reaches web-service, it generate needed data, send data that page needs
but when i open page in another browsers (Chrome, FF, etc), page does not reacts to the any data that server sends as callback. queries reaches web-service but all communication with page and host is stopping
all JS-libraries that i connect to page: 'jquery-2.1.0.min' and my own 'common.js'
so, how i can determine, what element is not working correctly in not-IE?
Here are some things you can try to avoid these kinds of issues:
Use jQuery 1.11.1 instead of jQuery 2.1.0 to improve compatibility between browsers.
In Chrome, right click anywhere on the page and select Inspect element. You should see a debug window open at the bottom half of the page. Navigate to the Console tab in this window to see any JavaScript errors.
In Firefox, install the Firebug add-in and use that to debug.
Make sure that you are not using any ActiveX. That is only compatible with IE.
You can use sites such as browsershots.org to test browser compatibility
Don't use browser / platform specific technologies such as Flash, Silverlight etc.

HTML5 website compatibility in Internet Explorer

I was going through a simple HTML5/CSS3 tutorial to build a basic website.I closely followed the tutorial to make myself understand the newly added tags use and developed what was taught online step-by-step.
However, the demo of the site I was creating worked fine on Internet-Explorer8 but when I completed my own development, though it worked fine in Chrome and Firefox but it didn't pick any design when I tried run it on Internet-Explorer8.
This however I understand is due to old versions of IE's not supporting newly added elements of HTML5 thus added a script HTML5shiv.js.
This should work fine however IE8 kept popping up the dialog box displaying that : It blocked some Active Content due to security reasons and if required, you can allow them to dosplay. This was never the case with the demo version of the website that I was making.
However, when I allowed the ActiveX controls in the IE8, everything worked fine.
The issue with me now is that if any of my website's user has disabled ActiveX-Controls in IE6,7 or 8, then my website would loose it''s designed structure. How can I get through it?
I assume you are loading html5shiv.js from a separate domain, if so try downloading it and hosting it with the rest of your website. This should solve your problem.
If you're developing your website locally (i.e. directly opened from a file on your computer), that can also cause this problem.
Update to users comment:
Hosting it should solve it. Instead of buying hosting though you could simply host on your localhost, to do that look into using something such as WAMP, or MAMP for Mac.
Alternatively, you can add <!-- saved from url=(0017)http://localhost/ --> to the top of your document which should disable the security policy. You can read more about that here.

Enable and Popup blocker in IE

I wrote a scripting logic in using ActiveX. When the application runs it is blocked by popup blocker. When I enabled it works fine, but I want to enable the popupblocker using JavaScript (especially in IE).
Obviously a website cannot modify the popup blocker settings. And that's a good thing.
You should avoid using ActiveX Controls because it is only supported by IE. Trying running your page on Firefox and it won't work.
Now the actual problem -
Firstly you need to understand what ActiveX Objects are used for? They basically allow a web application to interact with the client machine. For example it can use resources on my local hard drive. This is a security risk. So IE gives a warning for the same. You may disable it in your browser by going to Tools-> Internet Options -> Security Tab. Click "Custom Level" and change all the boxes with ActiveX text in it to "Enable".
But it will still show up in your client browsers.
So the point is try finding an alternative for it.
Hope this helps!
You cant. What you could do is have a message on screen which requests the user to turn off the popup blocker .

Launch mobile Safari from UIWebView *without* modifying app source?

I'm developing a small site that will only be viewed in-app inside a UIWebView, and one page has several links to an external website. I'd like these to open in mobile Safari, but all links inside the app load within the webview. Modifying the source of the app isn't an option since the site needs to be live before any changes could be submitted.
Is there a way to force a link inside a UIWebView to launch mobile Safari using HTML/5 or Javascript? Mimic shouldStartLoadWithRequest? Sneaky, hacky workarounds or brilliant alternate solutions?
(And, out of sheer curiosity... why not?)
It would be bad design to let sites access the frameworks on the iPhone via simple HTML. This would open up all sorts of security holes. Its not web behavior you want to alter, so I think you may need to change the app source. I still don't understand why that isn't an option. Could you go into more depth?
One option would be to add a custom URL handler. Your website could then determine if the "broswer" is the app and serve custom URLs for those links you'd like to maintain (aka open) in your app. Then, any standard HTTP/s URLs would open in Mobile Safari.
In other words, have your web server provide urls like myappurl:// for the links you'd like your app to handle, and http:// which would open Mobile Safari.

Categories