Silverlight Application - Embedded advertising possible with HTML or Silverlight? - silverlight-3.0

I have a 100% silverlight application that takes up the entire screen.
Plan A: I would like to embed other silverlight ads but I cannot find any companies that provide this service.
Plan B: Embed classic HTML ads into the app. I've found one way by playing around the with DIV's and Javascript but it seems like a major hack. do not want.
Anyone managed to display ads with silverlight?

the possible solution may be "you can use web service which feed ad-data to SL application, and then display it."

All silverlight application are embeded in html using object, for example:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
It means you still can have other html element in the page where you have silverlight. You even can create new html elements and add that to the page in your code behind.
So one solution is to create a div element in the page that is hosting silverlight and show it in front of silverlight object using z-index. And there are atleast two ways to implement this solution:
In code behind. Way to access html element in code behind file:
HtmlElement mydiv = HtmlPage.Document.GetElementByID("mydiv");
Using javascript
It is a workaround, but we have to stick with it until silverlight can embed html inside it.

Related

jquery mobile multi-page internal hyperlinking

This appears to be pretty basic but I can't figure it out.
Using a jqm multipage template, I'm trying to allow users to jump from a link one page (id='page1') directly to an image in another page (id='page2').
FIDDLE
It appears I am constrained, by html hyperlinking rules and jqm, to this:
<a href='#page2'>go to image on p2</a>
... which of course jumps the user to the top of page2.
But that's not what I want. I want the user to jump directly to the IMAGE, which is close to the bottom of page2, tagged like so:
<img id='image-id'>
But tagging the link with the image's id (not the page's id), i.e. tagging it like this
<a href='#image-id'>go to image on p2</a>
doesn't work.
I get the feeling I'm missing something very obvious, but can't figure it out.
Any suggestions? Or is this not possible?
I've got a different problem but found this question in my travels... thought I would add an extract from the jquery mobile page:
http://demos.jquerymobile.com/1.4.5/navigation-linking-pages/
Note: You cannot link to a multipage document with Ajax navigation active because the framework will only load the first page it finds, not the full set of internal pages. In these cases, you must link without Ajax (see next section) for a full page refresh to prevent potential hash collisions. There is currently a subpage plugin that makes it possible to load in multi-page documents.

Display external website page in asp .net mvc 5

I am building a website for a class project using ASP NET MVC 5, wherein I need a section of the website to display a page from a different website. The goal is to somehow embed that page in my view, so UI interactions are still possible with the embedded page, as if the page was visited directly in the browser (the end effect is that the page is rendered and allows interaction but my website theme always stays around it)
I know one way to do it is to just put it inside an iframe in my View. But I want to know if there is a different solution. My instructor suggested using partial views, but I can't figure out how to achieve the same result. Can anyone suggest a different way to achieve this ? Also, what would be the right way to do this in terms of security (I believe iframe is), but I want to know other's opinion ?
Thanks.
I suggest you use a sandboxed IFrame e.g.
http://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src="https://blah.com/index.html"
style="border: 0; width:130px; height:20px;">
</iframe>
You can tweak how much power the content in the Iframe has (i.e. can it run scripts).
I guess you could also look at using a partial view. My guess is you'd need to use a WebClient instance to download the HTML source of the target webpage, and then pass that HTML into a partial view. But I don't see how any script tags would render correctly for you, which means the page would not be interactive.

Is the iframe tag allowed within a trigger.io page (not a tabs page)?

Is the iframe tag allowed within a trigger.io page (not a tabs page) ?
For example,
<iframe src="http://www.facebook.com/plugins/comments.php?href=example.com&permalink=1" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:130px; height:16px;" allowTransparency="true"></iframe>
I've tried the statement above, but rather than displaying the content (for example, the real-time number of comments) inside the page, a new browser is opened.
The answer depends on the particular device, to some extent.
On iOS, sourcing an external HTML page (i.e. one not part of the app itself) in an iframe counts as a separate page load which we defer to the underlying device. The same is not true on Android - we'll make this more consistent in the future, but by moving Android towards iOS's behaviour, rather than the other way.
In general, we were not expecting your users to interact with web pages in this way: if they are moving outside of your app to use an external site, we would recommend making this explicit with the use of forge.tabs.open or forge.tabs.openWithOptions (docs).
Note that there is explicit wording in Apple guidelines which prohibits the simple display of external websites as an app!

iOS HTML Rewrite?

I've not written an iOS app and want to know if what I want to do is reasonably easy before I invest all my time in it. The idea is simply to leverage the built-in webkit methods to write my own browser. I've seen tutorials where this is done fairly easily. However, the twist is I want to apply some rewrite/regex rules prior to the page rendering. ie, you load http://example.com which is a page containing the word 'foo'. Prior to displaying the page, the app rewrites 'foo' to 'bar' and renders.
Is this possibly to do easily without actually writing a ground-up browser?
Thanks!
It's doable (assuming you're using the standard UIWebView component to render the page), and there are a few ways you could go about it. Among them:
You could download the HTML and parse it via Objective-C string handlers before loading it into the UIWebView
You coud use load the HTML as-is and use the UIWebview's stringByEvaluatingJavaScriptFromString: message to "inject" javascript onto the page, manipulating the DOM itself
You could go the Opera route, and pre-render the page via a server-side proxy before downloading it to the client.
How far down the rabbit hole you want to go would be up to you, of course. Easy is in the eye of the beholder.

jquery mobile - requesting multi-page page via changePage

From the index page of the site, I am loading another page which has 3 divs with the data-role of page.
However, jquery mobile only appends one of the pages to the dom.
I presume the changePage function is grabbing the first div with a data-role of page and inserting it. I wonder if there is a way to get it to insert all the divs with a data-role of page or dialog.
Any help more than appreciated.
thanks
What you are trying to do is currently not possible with JQM, as only the first page from a multipage gets loaded into the DOM.
I would point point you to a link in the JQM docs that would explain this behavior, but there isn't one... I already filed this as issue on Github, so that the Docs at least make clear what you can do and what does not work with multipages.
As I'm stuck with the same issue I started writing a plugin to be able to load multipages (among other things). I still have a few things to sort out, but when it's working I can send you the link.
You can use a "subpage" plugin to get the behavior you desire. Basically one page contains a bunch of subpages, which all get loaded into DOM. The pattern would be:
<div data-role="page">
<div data-role="subpage">
</div>
<div data-role="subpage">
</div>
<div data-role="subpage">
</div>
</div>
The project is available here: https://github.com/ToddThomson/jQuery-Mobile-Subpage-Widget.
I've personally been having problems with this plugin, but I think for simple scenarios, it works fine.
Also, there is no documentation for it. For example, I still don't know the proper way to call $.mobile.changePage() with this plugin. :)
According to JQM at this page:
"jQuery Mobile currently only supports loading of single page documents via AJAX. To navigate to a multi page document you must disable ajax on the link by adding the data-ajax="false" attribute. There is also a widget to allow for supporting sub-pages by Todd Thompson available at https://github.com/ToddThomson/jQuery-Mobile-Subpage-Widget"
You can also add rel="external" attribute to the href pointing to Page B.
rel="external" and data-ajax="false" will force JQM to load the entire page as new. Unfortunately, it appears this removes the ability to use a page transition from PageA to PageB.
Example: Page B
I'm now looking to load Page B with JQM methods instead of relying on the automagic mechanisms. It appears you must use single page templating throughout (as recommended) or pagecontainer load method (essentially the same as single page) if you want hashtag transitions within a "single page", after the DOM is initially loaded. For example, link to a single page, listen to "pageinit" of that page, then use pagecontainer("load"). Make sure the subsequent page (the page your're injecting) is not needed as a direct incoming page.

Resources