Why iframe is not loading all webpages in winjs app? - iframe

Hi All,
I took a blank WinJS Store app and placed the below code in default.html file
<iframe src="http://www.google.com" height="400" width="400"></iframe>
But the iframe is not loading the google home page. The page is left blank. While if I replace the src value to "http://www.palermo4.com" its working fine. Why is this strange behavior. Do we need to acquire any other permissions kind of thing for some urls? Kindly help me out.
Thanks in Advance

You can't load ooogle in iframe,since they are blocking this facility.
You can use Iframe for some other sites,but you won't get full controll of their JS[Loading sites] ,may have to face some breaking point in such sites.
if you really want to load google try this,.
1. Make your default browser as IE10.
2. trigger an event.
function openYourLink(){
var url = new Windows.Foundation.Uri("http://www.google.com")
Windows.System.Launcher.launchUriAsync(url);
}

In Windows 8.1 you'll also be able to use the webview control which is not sensitive to frame-busting code that sites like Google use.

Related

Chrome caching CSS but not loading images inside CSS file

We're having a weird problem at work that happens only in chrome. It looks like the css file is getting cached and the content of this file isn't getting re-downloaded.
The problem is that when using a fresh session for example "private session", the image "mainSprite.png" isn't getting displayed.
After some tests, I believe the problem is related to us doing redirects at the beginning if the user isn't authenticated. From what I understand, it might not complete the download of the sprites linked inside the css files. It will cache an invalid object as soon as the redirect starts and then on the following pages, it will fail to display a correct image since it cached something wrong.
The strange thing is that it actually loads the image completely at some point. But it looks like it's not refreshing it in memory...
I did a timeout of one second before starting redirects on first load and images correctly display. This is a quick fix and I can't expect every computer to load in 1 second every images contained in the css.
edit
As far as I can say, it really looks like a race condition. I changed the order of loading. We use require.js. Instead of loading js after css, I start js loading before. And images are getting loaded correctly now on my local server.
if someone is interested to look into it:
http://api.checklist.com
edit 2
When images aren't visible, opening new tabs will have the same problem. Closing the browser and reopening it will work on first load and images isn't being downloaded but loaded from Cache which means that before closing the browser, the image was indeed downloaded.
It looks like the problem coming from your redirects unfortunately i couldn't see your example ( link won't open ). Google chrome has indeed issues with caching it's annoying during development time ( clear up the cache, load new image, do the same for new image..), if you need to clear your cache try the folowing:
try to go to
chrome://chrome/settings/clearBrowserData
in your chrome browser and check the options:
Empty the Cache( i have also Clear download history and Delete cookies and other site and plug-in data )
click on 'Clear Browsing Data' button it should
All what you need to do is to trace your cash list via chrome, and from what I see is that you got this error which make it not cached:
Uncaught TypeError: Object [object Object] has no method 'placeholder'
So if you want to trace, you can use the manifest offline mode or you trace via your code.
Just following and test your page, I did catch where the error is:
file: scripts2.js Line 20 --> $('input[placeholder]').placeholder();
which you need to check the name of the place holder and change it here in this tag.
Thank you
I assume your server/backend app has routes set up. Like this Play! framework example:
# Ignore favicon requests
GET /favicon.ico 404
# Map static resources from the /app/public folder to the /public path
GET /public/ staticDir:public
# Catch all
* /{controller} {controller}.index
According your summary I suggest to set up a static folder route (where the images are) in config file or htaccess as you want, then check image url in browser url bar (with empty session). That should work!
First I would suggest that you first try to find ways to narrow the redirects. If it possible I would suggest that it would be much more advisable to try to create your content dynamically based on your users authentication using languages like PHP or ASP (just to name two).
The classic way of disabling the caching on a webpage is to set two <meta> tags inside of your <head> </head> tags. However, you should note that these are technically not "correct" as they are not part of any of the "offical" standards documentation. This also means that I would again lean towards my first suggestion of finding a better delivery system which in turn should prevent the problem.
So for "testing" purposes the tags would be:
<HEAD>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
</HEAD>
Maybe I don't understand your question or dilemma (maybe because of lack of explanation or because I can't see your page at that link since I run Chrome), but there's an example I ran across here that works in Chrome by just using Javascript/jQuery to load, instead of CSS:
http://jsfiddle.net/2Cgyg/6/
Use image at URL: http://www.w3schools.com/cssref/img_tree.gif
And although the accepted answer didn't work for me in Chrome, this is the question I got the jsFiddle above, from:
Load Image from javascript
All the caching, etc. is unnecessary, and even something you wouldn't want to do if your images are ever updated to something else - they won't appear without forcing a refresh which you can only do through altering the file name like this to avoid users not seeing your updated image:
myPic.jpg?MMDDYYYY
And you could set the date according to the date you are modifying it.
clean your browser history like cache,cookies
clean the temporary internet file
if problem not solved then reinstall browser your problem is solved definitely

Load FlowPlayer video dynamically into asp.net page

I tried passing in the name of the file via querstrying but it looks like flowplayer wants to load it before the Request.Querstring["videoName"] value is retrieved.
Any Idea?
Have your asp.net page generate the clip configuration dynamically. It's hard to be more specific without seeing your code.
http://flowplayer.org/documentation/configuration/clips.html

Adobe Air parent frame bridge

I tried following the tutorial at http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f11.html#WS5b3ccc516d4fbf351e63e3d118676a3fc7-7fea but just can't get it right.
I have an app with an iFrame. Dynamically loading into the iFrame are pages from a website. To ensure any links in these pages open in the local client browser, the iFrame content needs to call a function in the parent to launch the link as desired.
So the child iFrame needs to call the following function in the parent:
function openInBrowser(url) {
air.navigateToURL(new air.URLRequest(url));
}
How can I achieve this using the bridge technique?
Greg.
Ok, I guess the good old read the instructions worked! Although not in the above page, but a link from that page... ;(
I followed the tutorial at: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7e5c.html
and it worked very well!
Greg.

ASP.NET Build Images Links Dynamically

I am developing a website that has product images on an external server. I have code that tests to see if the image exists like (pseudo code):
DynamicString = FunctionThatCreatesDynamicString()
' DynamicString = "http://external_server/path/to/file1.jpg"
If ImageExists(DyanmicString) = StatusCode.200 Then
' Embed link in ASP.NET page
Else
' Embed not found image in ASP.NET page
End If
My code builds fine and appears to execute. The problem occurs when I attempt to view the external link in a browser, the image appears properly (I have to authenticate first, but that's OK considering I'm on an internal network and this app will be used internally).
However, when I attempt the view the source in my generated HTML page, I am seeing the image to the "Not Found" image when I know the image is there.
I compared all the characters in my dynamically assembled to the external link and all the characters are matching up correctly.
I'm wondering if the authentication has anything to do with why the image is not rendering properly on my rendered HTML.
Any thoughts?
It turns out the problem was the authentication to the images. I tried and was able to use a completely different approach. But thanks for the tip tangurena.

How to include HTML contents from another site? I have access to both sites

I have a site which is using DNN (DotNetNuke) as a content management system. I am using another site for my event registrations. I have sent them my template; which displays the basics including a hover menu with many different items in it.
Issue is - as I update the menu on my site using DNN, I need it to be reflected on the site using my template - without me having to send them a new file. Anyone have suggetsions on how to approach this?
I don't want to send the events provider all of the DNN DLLs as well as my database login information in order to render the menu.
I created a page on my site that is something like 'menu.aspx' - this produces the menu in HTML format, however it has tags like in it that I'd like to remove before serving it to them.
What is the best approach for this? Do I need to write a custom server control using XMLHttp? Can I accomplish this in Javascript?
Any advice much appreciated.
Thank you!
If both sites are hosted on the same domain (eg site1.domain.com and site2.domain.com) you can use JavaScript and XmlHttpRequest to insert code from one site to another. Otherwise, the Same Origin Policy prevents you from using AJAX.
If they're not on the same domain but you have access to the page on their website, you can simply include there a JS script from your site :
<script type="text/javascript" src="http://yoursite.com/code.js"></script>
In the JS, simply document.write() what you want on the page. This way, you can easily change the content of the page on their site without having to send them a new file.
Finally, you can also use an iframe on their site, pointing to a page on yours.
EDIT: As Vincent E. pointed out, this will only work if they're on the same domain - my bad.
If you are unwilling or unable to use frames, then I would set up an ashx on your DNN server which renders the menu (if you've got it in a user control all the better, as you can just instatiate it and Render it directly to the output stream) and then just make an Ajax call to that from your events page and insert it directly into the DOM.
Here's a quick and hacky jquery-based example of the events page end of things:
<script type="text/javascript">
function RenderMenu(data)
{
$('#Menu').html(data);
}
$(document).ready(function() {
$.ajax({
type : 'GET',
url : 'http://localhost/AjaxHandlers/Menu.ashx',
data : '',
success : RenderMenu,
});
});
</script>
You'll want an empty div with the ID 'Menu' on the page where you want your menu to sit, but apart from that you're good to go.
If for whatever reason you can't get the menu HTML in an isolated way, then you'll need to do some text processing in RenderMenu, but it's still do-able.
I am not a web expert, so don't shoot me.
Can't you just put their registration form into an iFrame in DNN ?

Resources