Loading PDF file/url shows black screen in Safari browser - javascript

The Following javascript code are used in my application to open the PDF file in new window, from the parent page.
onclick="window.open("myurl.pdf","Terms_and_Conditions","height=800,width=1000,dependent=yes,menubar=yes,scrollbars=yes,resizable=yes");"
I have tested in 5.1.4 version of Safari browser. It shows a blank black screen. Then,If i click/focus the window, the PDF content was loaded.
Please guide me to resolve. Thanks in advance.

Could you use an href with target="_blank" instead of javascript to do this? That way it would work even if the user has JS disabled.

Related

iFrame not loading properly in Chrome

I am attempting to show a simple mockup to a potential client of how he could stream media from his own online radio station to a page. The radio station was built using an external site and in Safari rendering the station's share link in an iFrame works perfectly, and plays immediately on page load without the user having to do anything. Here is the pure html code; there's no JS for this page now:
<iframe src="https://lucasdraft.out.airtime.pro/lucasdraft_a" frameborder="0"></iframe>
The CSS:
iframe {
height: 50px;
width: 200px;
float: right;
}
But in Chrome, half the time when I try to load the page the iframe doesn't show up at all and the page loads continuously with the status at bottom left displaying "Waiting for available socket"- again this never happens on Safari. When it does load in Chrome, instead of showing the basic media player from the external source it shows a sort of gray semi-circle with three dots. If I click this gray blob it begins playing, but this is very un-intuitive to a user not to mention ugly. I assume this is a security feature in Chrome but haven't found any reliable way of fixing it. Increasing the size of the iframe does not change anything.
Safari (working as expected):
Chrome loading error:
Chrome with cache cleared, after loading the iframe:
Thanks and anything helps in fixing this pesky error!
For the Waiting for available socket, a quick google search got me this answer. Chrome hangs after certain amount of data transfered - waiting for available socket It's always a good idea to google something before asking.
For the visual problem. the Url in your Iframe is calling a video. Different browsers use different style for their video player. Chrome just needs a little bit more height. I find that 100px works well.
I had the same issue(Worked in safari but not in chrome). In my case the issue was the Ad-blocker . Ad-blocker usually writes scripts to override the iframe styles.
Once I disable the ad-blocker or load the project in incognito(private browser) window the iframe content loaded successfully.

Google Chrome doesn't follow image redirect

I have to insert to HTML page image from facebook graph, for instance this one: http://graph.facebook.com/100004504487972/picture?type=large. In fact this link returns 307 Internal redirect.
I'm inserting this image with simple HTML img tag:
<img src="http://graph.facebook.com/100004504487972/picture?type=large" />
In most browsers it works well, but chrome for some reason doesn't follow redirect.
You can try this jsbin in different browsers to check out:
https://jsbin.com/yuhoqanisi/edit?html,output
I'm testing in latest chrome under ubuntu 16.04.
In fact it happen to be Ghostery extension for Chrome blocking image.

Javascript window.open() toolbar=no not functioning

I am attempting to open an html file in firefox with minimal extras (toolbars, menubars, addressbar, etc). Just the html contents of the webpage, and nothing else. I want to be able to do this within linux from the terminal. I also have to do it in such a way that it works across multiple linux machines running the same version of firefox. So this removes any possibility of using a profile. I was hoping there would be a simple parameter to firefox that would allow me to turn these settings off. I dont believe there is.
The only possibility I have found is through javascript's window.open. It appears the parameter specs to window.open arent even functioning in firefox 1.5.0.9. I have read that some of them were removed in firefox 3.0+, but have not found anything regarding the version I am using, 1.5.0.9.
This is what I am using to open my .html file using windows.open...
test.html:
<html>
<body>
<script>
window.open('./rel_notes.html','_self','toolbar=no,menubar=no')
</script>
</body>
</html>
And then just running 'firefox test.html' from the terminal.
Both the toolbar and menubar still appear when I do this. What am I doing wrong? Is there a easier way to do this?
If your browser settings allow pop-ups without notifications from X source (localhost i presume?) then the following might work:
window.open('./rel_notes.html',null,'menubar=no,toolbar=no');
window.open('','_self',''); //this is needed to prevent IE from asking about closing the window.
setTimeout('self.close();',500);
Taken from a link in the link bungdito gave me:
After a window is opened, JavaScript can't be used to change the features.
So by opening test.html, and then using window.open on _self, I am trying to adjust features to a window that has already been opened, using javascript.
Source: https://developer.mozilla.org/en-US/docs/DOM/window.open

How to view javascript generated html for Internet Explorer?

I am looking for a way in IE to view the html source generated from jQuery code.
Ex.
HTML:
<div id="myDiv"></div>
jquery:
var wrapper = $("myDiv");
var generated = $("<div>Hello world</div>");
wrapper.append(generated);
I'd like to be able to examine and hopefully tweak the source generated by appending the generated element, not in Chrome or Firefox, but in IE 8 (where the problem is). I think that IE Developer Tools only shows the downloaded source, not what is generated.
Thanks.
Try going to the HTML tab in IE developer tools and press the refresh icon (next to the save icon), it will show the latest DOM.
Example:
Go to script tab and do:
document.body.appendChild( document.createElement("div") );
Then go to the HTML tab and hit the refresh icon and open the body tag, it should show the appended div now.
I recommend Firebug Lite - http://getfirebug.com/firebuglite (it's Firebug for IE, sort of)
You should get Firebug Lite. You can check the code that jQuery does and much more.
Anyway, I recommend that you put Google Chrome Frame compatibility on your site, it will eliminate plenty of problems with your site (with the people that have Google Chrome Frame installed).

Firefox plugin development and embedding an .swf in xul with html:embed

I have a big problem with my firefox plugin. I have a button, which opens a new window for me, where I want to include that .swf file.
Here is the XUL code for the embedding:
<html:embed src="Reader.swf"
width="250"
height="250"
type="application/x-shockwave-flash" />
-> html namespace was set above:
xmlns:html="http://www.w3.org/1999/xhtml"
Reader.swf is in the same directory as the xul file
without the html:embed, the window opens without problems, but as soon as I change that, firefox crashes without warning or something, it just disapears from the process bar.
the .swf file works properly when I open it from my operating system (its windows 7 64 bit) and is coded in as3.
can somebody help me?
Instead of placing the swf file directly into the new window, try wrapping it in a minimal html page. Or you could use the html page that flash generates for you when you publish your movie. I haven't played with XUL, but I have noticed that placing swf files directly into browsers is a little inconsistent across browsers. For example, some browsers will scale the movie to 100% of the available window space, others will not.

Categories

Resources