Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8959243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:23:33+00:00 2026-06-15T15:23:33+00:00

My Windows 8 app allows sharing on 1 page (the high scores page) which

  • 0

My Windows 8 app allows sharing on 1 page (the high scores page) which worked fine but since the sharing code was only on the high scores page the app said “This app can’t share.” when the user tried to share on a page other than the high scores page.

It should say “There’s nothing to share right now.” To fix this I added sharing code to the home page, this fixed the issue but broke the sharing on the high scores page, I get this error “0x8000000e – JavaScript runtime error: A method was called at an unexpected time.”

My JavaScript code for the home page is:

(function () {
    "use strict";

    // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    var storage = Windows.Storage;
    var dtm2 = Windows.ApplicationModel.DataTransfer.DataTransferManager;
    // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    WinJS.UI.Pages.define("/pages/home/home.html", {
        // This function is called whenever a user navigates to this page. It
        // populates the page elements with the app's data.
        ready: function (element, options) {
            // TODO: Initialize the page here.

            // Initialize everything
            initialize();

            // Button listeners
            var add = document.getElementById("add");
            add.addEventListener("click", this.linkClickEventHandler, false);

            var sub = document.getElementById("sub");
            sub.addEventListener("click", this.linkClickEventHandler, false);

            var mul = document.getElementById("mul");
            mul.addEventListener("click", this.linkClickEventHandler, false);

            var div = document.getElementById("div");
            div.addEventListener("click", this.linkClickEventHandler, false);

            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            dtm2.getForCurrentView().addEventListener("datarequested", this.onDataRequested);
            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        },

        linkClickEventHandler: function (eventInfo) {
            ope = this.id;
            var link = "/pages/quiz/quiz.html";
            WinJS.Navigation.navigate(link);
        },

        // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        onDataRequested: function (e) {

        },
        // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        unload: function () {
            // TODO: Respond to navigations away from this page.

            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            WinJS.Navigation.removeEventListener("datarequested", this.onDataRequested);
            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        },
    });
})();

My JavaScript code for the high scores page is:

// For an introduction to the Page Control template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232511
(function () {
    "use strict";

    // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    var storage = Windows.Storage;
    var dtm = Windows.ApplicationModel.DataTransfer.DataTransferManager;
    // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    WinJS.UI.Pages.define("/pages/results/results.html", {
        // This function is called whenever a user navigates to this page. It
        // populates the page elements with the app's data.
        ready: function (element, options) {
            // TODO: Initialize the page here.

            // Show results
            showResults();

            // Button listeners
            var btnHome = document.getElementById("btnHome");
            btnHome.addEventListener("click", this.linkClickEventHandler, false);

            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            dtm.getForCurrentView().addEventListener("datarequested", this.onDataRequested);
            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        },

        linkClickEventHandler: function (eventInfo) {
            var link = "/pages/home/home.html";
            WinJS.Navigation.navigate(link);
        },

        // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        onDataRequested: function (e) {
            var request = e.request;
            request.data.properties.title = "Your Simple Math Results";

            var message = shareLine1 + " ";
            message += shareLine2 + " ";
            message += shareLine3;
            request.data.setText(message);
        },
        // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        unload: function () {
            // TODO: Respond to navigations away from this page.

            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            WinJS.Navigation.removeEventListener("datarequested", this.onDataRequested);
            // SHARING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        },

        updateLayout: function (element, viewState, lastViewState) {
            /// <param name="element" domElement="true" />

            // TODO: Respond to changes in viewState.
        }
    });
})();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:23:34+00:00Added an answer on June 15, 2026 at 3:23 pm

    You need to unattach the “datarequested” event when you navigate out of the page. This is, when the back button is pressed:

    dtm2.getForCurrentView().removeEventListener("datarequested", this.onDataRequested);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a Windows 8 app which allow sharing Image and text to
I'm creating a Windows Phone 7 app which allow to listen a web radio.
Currently I have Windows App which is directly opening database connection (SQL Server is
To provide some context, I'm interested in the creation of an app which allows
I have this windows app Cafe that allows the user to make their selection
I have used TimeSpan control in my windows app C# that allows the user
My Windows 8 app written in JavaScript allows the user to share while in
I am writing an app which allows users to enter some data into their
I am writing an app that allows creation of pppoe in windows phone 7.goal
I have an app which creates a series of modeless dialog windows which are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.